Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 56765 - StyledText - Fix calculating of cursor level
Summary: StyledText - Fix calculating of cursor level
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P1 normal (vote)
Target Milestone: 3.0 RC2   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-30 11:35 EST by Lina Kemmel CLA
Modified: 2004-06-04 18:39 EDT (History)
2 users (show)

See Also:


Attachments
Patch (2.17 KB, patch)
2004-05-27 15:22 EDT, Felipe Heidrich CLA
no flags Details | Diff
The whole file (StyledText.java) (258.11 KB, text/plain)
2004-05-28 15:50 EDT, Felipe Heidrich CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lina Kemmel CLA 2004-03-30 11:35:51 EST
Cursor level is broken in the following cases:

1. doBackspace(), doDelete().
Expected behavior: cursor level is set to the level of the deleted character.
Actual behavior: cursor level is set to the level of the preceding character.

2. doLineStart(), doLineEnd().
Expected: cursor level is derived from the paragraph level.
Actual: cursor level is derived from the level of the first/last character.

Suggested solution: cache cursor level in the above methods.
Comment 1 Lina Kemmel CLA 2004-03-31 11:57:28 EST
The first case is regression since M7 (introduced by M8, when StyledText 
changed to work with TextLayout).
The second case is enhancement.
Comment 2 Felipe Heidrich CLA 2004-03-31 12:21:17 EST
I expect this to be wrong, I threw away a lot of code in this area. I tried to 
fix it before releasing the new code but I didn't have time to write the code 
that works for all the cases, the code I wrote would fails for latin numbers 
surrunded by RTL text.
Comment 3 Felipe Heidrich CLA 2004-05-27 15:22:54 EDT
Created attachment 11234 [details]
Patch

Hi Lina, could apply this patch into StyledText and verify if it fixes case 1?
Comment 4 Felipe Heidrich CLA 2004-05-28 15:50:10 EDT
Created attachment 11286 [details]
The whole file (StyledText.java)

just in case you have problem with the patch
Comment 5 Lina Kemmel CLA 2004-05-30 08:44:58 EDT
Hi Felipe,
Yes, case 1 seems to be fixed :)
Comment 6 Felipe Heidrich CLA 2004-05-31 14:11:28 EDT
Steve, this a regression in StyledText, after deleting a character (in the 
boundary direction) the caret is placed in the wrong position.
The fix is not hard or dangerous and even if it's wrong it should only affect 
bidi.

Do you approve releasing the code for RC2 ?
(The code attached here is not in it's final form)
Comment 7 Steve Northover CLA 2004-05-31 14:56:19 EDT
Yes.
Comment 8 Felipe Heidrich CLA 2004-06-04 18:39:38 EDT
Fixed > 20040604

Please, test it using next monday integration build (from the afternoon) or 
late.

Ps.: I'm open another pr about lineUp/lineDown.