| Summary: | The styledtext caret position is incorrect when switch Orientation | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | yanghang | ||||||||||
| Component: | SWT | Assignee: | Felipe Heidrich <eclipse.felipe> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | eclipse.felipe | ||||||||||
| Version: | 3.4.2 | ||||||||||||
| Target Milestone: | 3.7 M5 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Windows XP | ||||||||||||
| Whiteboard: | |||||||||||||
| Bug Depends on: | 29779 | ||||||||||||
| Bug Blocks: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
yanghang
Created attachment 184927 [details]
original size
Created attachment 184928 [details]
change bigger
Created attachment 184929 [details]
change smaller
Created attachment 184957 [details]
sample code
I suspect this is a bug in Windows and should be fixed when we finish Bug 29779. The bug is here: Canvas
LRESULT WM_WINDOWPOSCHANGED (int /*long*/ wParam, int /*long*/ lParam) {
LRESULT result = super.WM_WINDOWPOSCHANGED (wParam, lParam);
//if (result != null) return result;
/*
* Bug in Windows. When a window with style WS_EX_LAYOUTRTL
* that contains a caret is resized, Windows does not move the
* caret in relation to the mirrored origin in the top right.
* The fix is to hide the caret in WM_WINDOWPOSCHANGING and
* show the caret in WM_WINDOWPOSCHANGED.
*/
boolean isFocus = (style & SWT.RIGHT_TO_LEFT) != 0 && caret != null && caret.isFocusCaret ();
if (isFocus) caret.setFocus ();
return result;
}
Set orientation for StyledText does not update the style field.
So this (style & SWT.RIGHT_TO_LEFT) != 0 still returns false after StyledText#setOrientation(SWT.RIGHT_TO_LEFT)
This will be fixed when we fix Bug 29779.
If we don't fix Bug 29779, we can fix this bug by adding:
int style = getStyle(); before the test.
Fixed in HEAD. |