Bug 133053 - BiDi3.2: GEF text editor has problems in cursor location.
Summary: BiDi3.2: GEF text editor has problems in cursor location.
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-23 14:19 EST by Ahmed Farrag CLA
Modified: 2008-07-10 13:26 EDT (History)
8 users (show)

See Also:


Attachments
screen shot (140.72 KB, image/pjpeg)
2006-03-23 14:21 EST, Ahmed Farrag CLA
no flags Details
Screen capture of example "Englsih Banana Tree" (19.32 KB, image/pjpeg)
2006-03-28 13:56 EST, Ahmed Farrag CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Farrag CLA 2006-03-23 14:19:05 EST
the cursor is in a place, and the typed characters appear in another place.

Steps to recreate the problem:
1. Create a file using the WYSIWYG example file wizard.
2. Try inserting and deleting mixed Arabic and English text.

Expected bevaviour:

Typed characters and the curser should be in the same place.

Problem:
the typed characters appear in a distance from the curser.
please see the screen shot
Comment 1 Ahmed Farrag CLA 2006-03-23 14:21:35 EST
Created attachment 36835 [details]
screen shot
Comment 2 Pratik Shah CLA 2006-03-26 20:47:19 EST
That's because the cursor's at a transition point between an RTL and an LTR run.  If you type an LTR-typed character, it will appear where the cursor is.

Ahmed, can you reproduce this same behaviour in Microsoft Word?
Comment 3 Ahmed Farrag CLA 2006-03-28 13:48:05 EST
This is not because the curser is at a transition point.  Please try inserting the following text:
- English <space> "."
- Press home key.
- The curser will be placed to the left of the dot while it is expected to be placed to the left of E as E is the beginning of the buffer.

Also, please type the following text:
English Tree Banana
- Now place the curser to the right of the letter 'h'.
- Change the keyboard layout to Arabic. (Alt+Left Shift)
- Insert any Arabic text, say, ABCD.
You will see that the curser is in one position and the Arabic text appears in another position.

Please see the attached screen capture for further illustration.
Comment 4 Ahmed Farrag CLA 2006-03-28 13:56:00 EST
Created attachment 37126 [details]
Screen capture of example "Englsih Banana Tree"
Comment 5 Steven R. Shaw CLA 2006-04-03 10:37:28 EDT
Pratik - were you going to look into this problem?  Can I assign the bugzilla to you?
Comment 6 Steven R. Shaw CLA 2006-04-04 13:42:04 EDT
Cherie - you'll have to have a look at this...
Comment 7 Cherie Revells CLA 2006-04-06 11:34:16 EDT
This seems to be a problem with not only GEF but even text editors and dialogs in Eclipse.  Here is one way to reproduce in Eclipse:

To reproduce:
- Start an Eclipse runtime with options -dir rtl
- Create a project called "abc".
- Right-click project > Refactor > Rename.
- In the dialog, put the text cursor between the 'a' and the 'b'.
- Change the input keyboard to arabic and enter a key.
- The text is now displayed as "bc?a".  The arabic character was put in the wrong spot.

I'm not sure which component should own this.  Probably SWT?
Comment 8 Cherie Revells CLA 2006-04-06 14:15:39 EDT
Ok, it seems that I misinterpreted the issue.  The text is supposed to jump to another location, but the cursor is supposed to move with it.

Note: This works fine in GMF, just not in the WYSIWYG editor.
Comment 9 Cherie Revells CLA 2006-04-07 17:30:29 EDT
Downgrading the priority for the following reason:
- It only occurs in right-to-left mode when mixing right-to-left and left-to-right languages.  How often are clients going to be working in right-to-left mode?
- The issue may be specific to the GEF WYSIWYG example or specific to GEF's TextLayout.  It does not occur in text on notes in GMF so it is not such a widespread problem.

Notes for when an attempt is made to resolve this defect again:
- I spent two days investigating this, but with little knowledge of BIDI issues and GEF I didn't make much progress.
- It appears the location of the cursor is reversed from where it should be.
- Good points for debugging are: ChangeString.getResultingLocation(), Textflow.GetCaretPlacement().
Comment 10 Steven R. Shaw CLA 2006-04-10 10:55:22 EDT
Removing target milestone.  This defect will be prioritized against other outstanding defects in GMF.
Comment 11 Ahmed Farrag CLA 2006-04-12 08:18:27 EDT
(In reply to comment #7)

This is actually the expected behavior.  A good correct reference is Notepad.  The scenario you described works as expected. (you can try it on notepad)

The incorrect behavior is detailed in (comment #3) which is very different than your scenario.
Comment 12 Ahmed Farrag CLA 2006-04-12 08:47:18 EDT
(In reply to comment #9)

There seems to be a problem in the function that maps the logical indexes (Characters positions in storage) to visual ones (Characters positions on display) and vice versa.
Consider the example of mixed Arabic and English text below, where characters in caps represent Arabic characters:

When a user types the string "engABC", it is displayed as "engCBA".
Hence, in storage array, the character 'A’ has index 3, while in visual array (used for display), it has the index 5.
Comment 13 Cam-Thu Le CLA 2006-04-25 17:11:20 EDT
This problem is marked as a serious bug. Can it be fixed before TVT start ?
Comment 14 Steven R. Shaw CLA 2006-04-25 17:14:53 EDT
In response to comment#13:  we downgraded this defect based on our evaluation.  See comment #9.  It is unlikely to be addressed before TVT.
Comment 15 Anthony Hunter CLA 2007-04-26 18:42:07 EDT
Defer BIDI issues to the next release.