Project: SWT
Bug 11587 BIDI:Java editor and Text editor: User Interface issues.
Reported: 2002-03-18 13:55:03 | Status: resolved fixed

Problem was found in Eclipse R2, build 20020214. User Interface Issues The UI issues can be divided in 3 categories: * no setting of the keyboard language when needed * bad positioning of the caret * no visual feedback for boundary condition They apply to both the Java and the Text editors. 1. No setting of keyboard language after some operations There are a number of cases where the keyboard language should be set, and this does not happen. 1a) After removing a character with Del, the keyboard language must be set corresponding to the removed character (like it happens after skipping a character with Left or Right arrows). 1b) After removing a character with Backspace, the keyboard language must be set corresponding to the removed character (like it happens after skipping a character with Left or Right arrows). 1c) After skipping to the next or previous word (using Ctrl+Right/Left arrow), the keyboard language must be set corresponding to the first character of the word. 2. Bad caret positioning after some operations There are a number of cases where the caret is not positioned where it should. 2a) When typing data Rule: after typing a character, the caret must be adjacent to the last typed character. On an empty line, type DEF123 This is displayed (correctly) 123FED Note that while typing the number, the caret is displayed (correctly) on the right side of the last digit entered. Now start with a line containing abcxyz Put the cursor between c and x, type DEF123 displaying abc123FEDxyz The caret behaves like before (this is good). Now start with a line containing DEFGHI It is displayed (correctly) IHGFED Put the caret between G and F, type 123 The caret behaves differently: it always appear on the left side of the leftmost digit. It should appear as before, on the right side of the last digit entered. 2b) After Right arrow Rule: after pressing left or right arrow, the caret must be adjacent to the character skipped, after it for Right arrow, before it for Left arrow. Note that after is on the right side for a character in a LTR segment and on the left side for a character in a RTL segment; before is on the left side for a character in a LTR segment and on the right side for a character in a RTL segment. Start with a line containing abcDEFGhiJKL123MNO456xyz displayed as abcGFEDhi456ONM123LKJxyz Start from the home position, and press Right arrow repeatedly. The rule is respected, except - after skipping over L: the caret should stand on the left side of L, but it stands on the left side of 1 - after skipping over 3: the caret should stand on the right side of 3, but it stands on the right side of M Note that Left arrow conforms to the rule in all cases. 2c) After Backspace Rule: after pressing Backspace, the caret must stand at the location of the removed character. Start with a line containing abcDEFGhiJKL123MNO456xyz displayed as abcGFEDhi456ONM123LKJxyz Case 1: Put the caret between x and y, press Backspace: the x is removed and the caret stands to the left of y (correct). Press Backspace again: 6 is removed (correct), but the caret still stands to the left of y; it should stand to the right of 5. Case 2: Put the caret between 4 and 5, press Backspace: the 4 is removed and the caret stands to the left of 5 (correct). Press Backspace again: O is removed (correct), but the caret still stands to the left of 5; it should stand to the left of N. Case 3: put the caret between M and N, press Backspace: the M is removed and the caret stands to the right of N (correct). Press Backspace again: the 3 is removed (correct), but the caret still stands to the right of N; it should stand to the right of 2. 2d) After Del Rule: after pressing Del, the caret must stand at the location of the removed character. Start with a line containing abcDEFGhiJKL123MNO456xyz displayed as abcGFEDhi456ONM123LKJxyz Case 1: Put the caret between K and L, press Del: the L is removed (correct) but the caret stands on the left of 1; it should stand on the left of K. Case 2: Put the caret between 2 and 3, press Del: the 3 is removed (correct) but the caret stands on the right of M; it should stand on the right of 2. Case 3: Put the caret between 5 and 6, press Del; the 6 is removed and the caret stands on the right of 5 (correct). Press Del again: the x is removed (correct), but the caret still stands to the right of 5; it should stand to the left of y. 2e) After Next/Previous Word Rule: after skipping to the Next or Previous word (using Ctrl+Right/Left arrow), the caret should precede the first logical character of the word. Start with a line containing abc def GHI JKL MNO pqr stu displayed as abc def ONM LKJ IHG pqr stu When starting on the left and pressing Ctrl+Right arrow repeatedly, the caret should stop on the left of d, then on the right of G, then on the right of J, then on the right of M, then on the left of p, then on the left of s. When starting on the right and pressing Ctrl+Left repeatedly, the caret should stop at the same positions in reverse order. Practically, Ctrl+Left behaves as required, but Ctrl+Right misbehaves at the transition from a LTR word to a RTL word: stops on the left of O instead of the right of G. 3. No visual feedback for boundary condition When the caret position is remote from the next logical character, some visual indication should be given. Example: a line contains abcxyz which is displayed abcxyz Put the caret between c and x and type DEF, the data is now abcDEFxyz displayed abcFEDxyz, and the caret stands to the left of F, while the next logical character (the one which will be deleted if we press Del) is x, which is visually remote from the caret position. We call that a boundary condition. It is useful to provide the user with an indication of boundary conditions: this could be done using the shape of the caret, its color, its blinking rate, or any other method (Java LayoutText widget displays 2 carets on boundary condition).

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextBidi.java