Project

General

Profile

Bug #9807

Ctrl-A and select-all do not work in an editor when the first line is empty after pressing Enter

Added by Andreea Bârzu over 1 year ago. Updated over 1 year ago.

Status:
Test
Priority:
Normal
Assignee:
Andreea Bârzu
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

History

#1 Updated by Andreea Bârzu over 1 year ago

Testcase:

DEFINE VARIABLE ed AS CHARACTER VIEW-AS EDITOR
     SIZE 30 BY 4 NO-UNDO.
def frame fr ed.
enable all with frame fr.
wait-for close of current-window.


Press ENTER and write something on the second line. Press CTRL_A / right-click and choose select-all, no selection is made.

#2 Updated by Andreea Bârzu over 1 year ago

  • reviewer Hynek Cihlar added

When select-all/ctrl-a is chosen, setSelection() is called. For the use-case from #9801-1 there are 2 lines(the first one is "\n" and the second one contains some text). We reach the for loop that goes through each line. For the first line, rightOffset becomes 0 and min is 0, so selectionStart is not updated. It will be when we reach the second line, with the wrong values. I believe the solution is this one:

=== modified file 'src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java'
--- old/src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java    2025-03-14 10:18:35 +0000
+++ new/src/com/goldencode/p2j/ui/client/gui/EditorGuiImpl.java    2025-03-19 10:02:26 +0000
@@ -1708,7 +1708,7 @@
          final Line line = parsedText.get(y);
          final int rightOffset = line.getOffset() + line.length();

-         if (selectionStart == null && rightOffset > min)
+         if (selectionStart == null && rightOffset >= min)
          {
             selectionStart = new NativePoint(min - line.getOffset(), y);
          }

Hynek, what do you think about this solution?

#3 Updated by Andreea Bârzu over 1 year ago

  • Assignee set to Andreea Bârzu

#4 Updated by Andreea Bârzu over 1 year ago

  • % Done changed from 0 to 100
  • Status changed from New to WIP
  • Assignee deleted (Andreea Bârzu)

Committed 9807 / revision 15792.
Hynek, can you please review?

#5 Updated by Andreea Bârzu over 1 year ago

  • Status changed from WIP to Review

#6 Updated by Andreea Bârzu over 1 year ago

  • Assignee set to Andreea Bârzu

#7 Updated by Hynek Cihlar over 1 year ago

  • Status changed from Review to Internal Test

Andreea Bârzu wrote:

Committed 9807 / revision 15792.
Hynek, can you please review?

Code review. The changes look good. Please do good amount of GUI regression testing.

#8 Updated by Razvan-Nicolae Chichirau over 1 year ago

On Andreea's request, ChUI regression tests were run, and they passed. ✅

#9 Updated by Andreea Bârzu over 1 year ago

  • Assignee deleted (Andreea Bârzu)
For GUI regression testing I included:
  • editor with no text
  • text is multi-line in editor
  • text is multi-line in editor and cursor is on an empty line
  • text is multi-line and the first line is empty

I also smoke tested a customer large application and asked Andrei to test too. There were no regressions found. From xfer project there are no tests including CTRL_A or select_all. I believe there is nothing else to be tested.

#10 Updated by Andreea Bârzu over 1 year ago

  • Assignee set to Andreea Bârzu

#11 Updated by Radu Apetrii over 1 year ago

  • Status changed from Internal Test to Merge Pending

Sooo, 9807a can be merged now.

#12 Updated by Andreea Bârzu over 1 year ago

  • Status changed from Merge Pending to Test

Branch 9807a was merged into trunk as rev.15802 and archived.

Also available in: Atom PDF