mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-57848 Not display caret with the mouse cursor correctly
Corrected (x; y) -> VisualPosition mapping algorithm
This commit is contained in:
@@ -960,6 +960,10 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
if (charWidth < 0) {
|
||||
charWidth = EditorUtil.charWidth(c, fontType, this);
|
||||
}
|
||||
|
||||
if (charWidth <= 0) {
|
||||
charWidth = spaceSize;
|
||||
}
|
||||
|
||||
if (x >= px && c == '\t' && !onSoftWrapDrawing) {
|
||||
if (mySettings.isCaretInsideTabs()) {
|
||||
@@ -975,8 +979,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
if ((x - px) * 2 < charWidth) column++;
|
||||
}
|
||||
else {
|
||||
column += (px - x) / spaceSize;
|
||||
if ((px - x) * 2 >= spaceSize) {
|
||||
int diff = px - x;
|
||||
column += diff / spaceSize;
|
||||
if ((diff % spaceSize) * 2 >= spaceSize) {
|
||||
column++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user