Community
Participate
Working Groups
Build Identifier: SWT3.4.2 switch styledtext Orientation, and resize styledtext size, the caret position is incorrect. Reproducible: Always Steps to Reproduce: 1. launch my sample code 2. press CTRL+G to swith Orientation from LTR to RTL 3. resize the shell Bug: if change size smaller, the caret is lost; if change size bigger, the caret is not at line end
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.