Open nlisker opened 5 months ago
@nlisker thank you for reporting this issue!
Is this something you would like to work on or were you just reporting it? :-)
Just reporting. I don't know SWT and the Eclipse inner workings well enough to be able to work on this in a meaningful amount of time.
not reproducible with a plain org.eclipse.swt.custom.StyledText
I was able to reproduce this issue with plain org.eclipse.swt.custom.StyledText. I used org.eclipse.swt.snippets.Snippet126 for testing and was able to replicate the bug. Here’s what I found:
I tested various positions and chars -> see image The width of the text is set in the Method org.eclipse.swt.graphics.TextLayout.shape(long, StyleItem) on line 3897. It gets the width from the method OS.ScriptPlace. There is probably somewhere a rounding error in the code. I will test if the same problem occurs on Linux. When it works normally on Linux, it could be a Windows problem.
Image Explanation: For Example: D⭳ should be 8 + 5 = 13 and not 14.
Describe the bug Redirected from Eclipse JDT: https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1403
Adding some unicode characters to a text editor can cause either a change in the font of the line in which the character is added, or the character to not be displayed correctly.
To Reproduce Open any text file in a text editor. My demonstration is with a .java file, but in the link above a .txt file is also used. Type text into that file, for example: (
" abc "
).Copy the character
⭳
(\u2B73
).←
(\u2190
). a. Paste it between⭳
andabc
, the characters are shown correctly and the font does not change: , b. Paste it at the edge, and the problem resurfaces:The same issue occurs with the character
⮠
(\u2BA0
).Expected behavior The characters will show correctly and the string will not change its font regardless of the positions those characters appear at.
Environment:
Select the platform(s) on which the behavior is seen: Only tested on Windows.
Additional OS info (e.g. OS version, Linux Desktop, etc) Windows 10
JRE/JDK version 21 and 22
Version since Eclipse 2024-03, haven't tested older versions. Text file encoding doesn't seem to matter. Tested UTF-8, UTF-16, UTF-16BE, UTF-16LE and ISO-8859-1.