| Summary: | [BiDi] Add contextual base text direction support for BidiUtils.applyTextDirection(control, textDirection) API | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Moshe WAJNBERG <wajnberg> | ||||
| Component: | UI | Assignee: | Moshe WAJNBERG <wajnberg> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | daniel_megert, Lars.Vogel, Lina.Kemmel, markus.kell.r, tomerm, wajnberg | ||||
| Version: | 4.5 | Flags: | markus.kell.r:
review+
Lina.Kemmel: review+ daniel_megert: review+ |
||||
| Target Milestone: | 4.5 RC2 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Moshe WAJNBERG
Created attachment 253479 [details]
Adding auto text direction for BidiUtils.applyTextDirection(control, textDirection)
Hello Markus,
Could you please review these changes ?
Thank you very much for your review
*** Bug 465496 has been marked as a duplicate of this bug. *** I'll test/review tomorrow. One comment on the patch.
if (LEFT_TO_RIGHT.equals(textDirection)) {
textDir = SWT.LEFT_TO_RIGHT;
} else if (RIGHT_TO_LEFT.equals(textDirection)) {
textDir = SWT.RIGHT_TO_LEFT;
} else if (AUTO.equals(textDirection)) {
- auto = true;
+ textDir = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
}
......................
I suggest to keep "auto = true;" line, since (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT) is not supported by StyledText yet.
For the same reason:
- } else if (control instanceof StyledText && (auto || textDir != 0)) {
+ } else if (control instanceof StyledText && textDir != 0) {
- keep the old code :
"} else if (control instanceof StyledText && (auto || textDir != 0)) {"
(In reply to Moshe WAJNBERG from comment #1) > Created attachment 253479 [details] [diff] > Adding auto text direction for BidiUtils.applyTextDirection(control, > textDirection) +1 for RC2. Verified that the patch works and effectively only changes the behavior when Control#setTextDirection(int) is called with SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT. Filed bug 467601 for an issue in that API. But that shouldn't stop this fix. Lina and Dani, do approve for RC2? I think that in applyTextDirection the following section:
if (control instanceof Text && textDir != 0) {
applyBidiProcessing((Text) control, textDirection);
} else if (control instanceof StyledText && textDir != 0) {
applyBidiProcessing((StyledText) control, textDirection);
} else if (control instanceof Combo && textDir != 0) {
applyBidiProcessing((Combo) control, textDirection);
} else if (textDir != 0) {
control.setTextDirection(textDir);
}
- can be changed to:
if (control instanceof StyledText && textDir == SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT) {
applyBidiProcessing((StyledText) control, textDirection);
} else if (textDir != 0) {
control.setTextDirection(textDir);
}
- since only StyledText with AUTO direction needs now a SegmentListener...
This, of course, applies to win32... On GTK, SegmentsListener has an added value also for Text. (In reply to Lina Kemmel from comment #8) > This, of course, applies to win32... On GTK, SegmentsListener has an added > value also for Text. Yes, and that's why we should go with the proposed patch. The simplification on Windows is not necessary and would add undue risk in RC2. Absolutely, agree, thanks. +1 from me too. (In reply to Lina Kemmel from comment #10) > Absolutely, agree, thanks. > +1 from me too. Lina, please set the review flag. Done! (In reply to Moshe WAJNBERG from comment #1) > Created attachment 253479 [details] [diff] > Adding auto text direction for BidiUtils.applyTextDirection(control, > textDirection) Submitted with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=6fb0a9af7ffa9b88dd0aa37b7606ae4f46a02d93 Verified that the fix is in I20150520-2000. |