IDEA-201625 Text jitter in editor when tabs are used for indentation (on a fractional-scale monitor on Windows)

another attempt to fix (trying to avoid IDEA-202087)
This commit is contained in:
Dmitry Batrak
2018-11-20 16:52:34 +03:00
parent ed58329ad0
commit 660fdc8a2e
@@ -362,10 +362,10 @@ public final class EditorUtil {
if (tabSize <= 0) {
return x + plainSpaceWidth;
}
tabSize *= plainSpaceWidth;
float tabSizePixels = tabSize * plainSpaceWidth;
int nTabs = (int) (x / tabSize);
return (nTabs + 1) * tabSize;
int nTabs = (int) ((x + plainSpaceWidth / 2) / tabSizePixels);
return (nTabs + 1) * tabSizePixels;
}
public static int textWidthInColumns(@NotNull Editor editor, @NotNull CharSequence text, int start, int end, int x) {