[macOS] StyledText: an arrow key during Korean IME composition discards the composing syllable instead of committing it
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 46/100
Hướng nghiên cứu
Start by comparing how StyledText handles arrow-key input during Korean IME composition with the plain Text widget, using the reproduction in the issue on macOS with the 2-Set Korean input source. The issue also points to #2412 as a potentially related case. Done means the composing syllable is committed before the caret moves, rather than being discarded.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
On macOS, an arrow key pressed while the Korean IME is composing discards the composing syllable instead of committing it. The character is lost outright — it never reaches the widget's text, and there is no undo path back to it.
A plain Text in the same application commits it correctly on the same keystrokes, so this is specific to StyledText.
To Reproduce
This snippet puts a StyledText above a Text so the two can be compared in one run. Each readout prints what that widget's own text model holds.
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class StyledTextKoreanArrow {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
new Label(shell, SWT.NONE).setText("StyledText");
final StyledText styled = new StyledText(shell, SWT.BORDER);
styled.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final Label styledReadout = new Label(shell, SWT.NONE);
styledReadout.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Runnable refreshStyled =
() -> styledReadout.setText(describe(styled.getText(), styled.getCaretOffset()));
refreshStyled.run();
styled.addModifyListener(e -> refreshStyled.run());
styled.addCaretListener(e -> refreshStyled.run());
new Label(shell, SWT.NONE).setText("Text (single line)");
final Text text = new Text(shell, SWT.BORDER | SWT.SINGLE);
text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
final Label textReadout = new Label(shell, SWT.NONE);
textReadout.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Runnable refreshText =
() -> textReadout.setText(describe(text.getText(), text.getCaretPosition()));
refreshText.run();
text.addModifyListener(e -> refreshText.run());
text.addListener(SWT.KeyUp, e -> refreshText.run());
shell.setSize(620, 320);
shell.setText("SWT " + SWT.getVersion() + " — Korean IME arrow");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
private static String describe(String content, int caret) {
StringBuilder codePoints = new StringBuilder();
content.codePoints().forEach(cp -> codePoints.append(String.format("U+%04X ", cp)));
if (codePoints.length() == 0) {
codePoints.append("(empty)");
}
return "text: \"" + content + "\" caret: " + caret + " " + codePoints;
}
}
Select the macOS 2-Set Korean input source, then in each box:
- Type
가나, then begin다and stop. It stays underlined — still composing. - Press ← once.
StyledText after the arrow, with the composing syllable gone:
text: "가나" caret: 2 U+AC00 U+B098
Text, same keystrokes, with it committed before the caret moved:
text: "가나다" caret: 2 U+AC00 U+B098 U+B2E4
While composing, both widgets read "가나" and draw 다 underlined. That part is expected — the preedit is not in the text yet. The difference is what the arrow does with it: Text commits it, StyledText drops it.
Arrow presses after the first only move the caret, since there is no composition left to lose.
Expected behavior
An arrow key arriving during composition should commit the preedit and then move the caret, which is what Text does here and what native macOS controls do.
Screenshots
The readouts quoted above are the widgets' own getText() output rather than a description of the screen, so they carry the same evidence; happy to attach captures if that is easier to read.
Environment:
- Select the platform(s) on which the behavior is seen:
-
- All OS
-
- Windows
-
- Linux
-
- macOS
- Additional OS info (e.g. OS version, Linux Desktop, etc)
macOS 26.6.2, Apple Silicon. Input source: 2-Set Korean (한국어 두벌식).
- JRE/JDK version
Temurin 20.0.1 (aarch64).
Version since
Seen on SWT 3.130.0 (SWT.getVersion() reports 4969). Not bisected — downstream reports of the same symptom go back to 2020 (DBeaver 7.3 on macOS 10.14), so it is unlikely to be a recent regression.
Workaround (or) Additional context
No workaround beyond committing the syllable first — press Space and delete it, or switch the input source — before moving the caret.
Possibly the same root as #2412, which reports Backspace deleting one character too many in StyledText while the Korean IME is active: same widget, same platform, same input source, and also a key arriving mid-composition that is not reconciled against the marked text. Filed separately because the visible outcomes differ, but one fix for how StyledText treats a key press during composition may cover both.
Downstream this is dbeaver/dbeaver#10615, open since 2020 and labelled a third-party issue. The tracker linked there, bugs.eclipse.org 371397, no longer leads anywhere actionable — that report sits under the archived z_Archived product against the PDT component and the Carbon platform, so it is not tracking the SWT code this lives in. Raising it here so there is a live report against the right component.
- Ngôn ngữ chính
- Java
- Star
- 202
- Fork
- 206
- Merge trung bình
- 14 giờ 7 phút
- Pull request đã merge (30 ngày)
- 103
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của eclipse-platform/eclipse.platform.swt
-
`SWT_AWT.initFrame` takes `(long, String)` in Java; the GTK native declares no `className` and the Cocoa native types it `const char *`Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
eclipse-platform/eclipse.platform.swt#3665 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
eclipse-platform/eclipse.platform.swt#3546 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
eclipse-platform/eclipse.platform.swt#3428 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
eclipse-platform/eclipse.platform.swt#3336 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
eclipse-platform/eclipse.platform.swt#3718 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của eclipse-platform/eclipse.platform.swt
Issue tương tự
-
[BUG] 增量 SSE 解析器未识别单独 CR 换行,导致事件无法及时交付Có thể đã có người làm @king-wwwhhh đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
langchain4j/langchain4j#6669 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
OpenAPITools/openapi-generator#25237 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-area-label
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
quelea-projection/Quelea#711 ·
-
bug pdd
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 67/100
objectionary/eo#9450 ·
Maintainer thường phản hồi trong vòng 1 ngày