Skip to content
Snippets Groups Projects
Commit 7ad2ce62 authored by Adrian Heine's avatar Adrian Heine Committed by Marijn Haverbeke
Browse files

Fix coordsChar at end and beginning of wrapped bidi lines

parent e49d5e89
No related branches found
No related tags found
No related merge requests found
...@@ -427,7 +427,7 @@ export function coordsChar(cm, x, y) { ...@@ -427,7 +427,7 @@ export function coordsChar(cm, x, y) {
function wrappedLineExtent(cm, lineObj, preparedMeasure, y) { function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
let measure = ch => intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line") let measure = ch => intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line")
let end = lineObj.text.length let end = lineObj.text.length
let begin = findFirst(ch => measure(ch).bottom <= y, end - 1, 0) + 1 let begin = findFirst(ch => measure(ch - 1).bottom <= y, end, 0)
end = findFirst(ch => measure(ch).top > y, begin, end) end = findFirst(ch => measure(ch).top > y, begin, end)
return {begin, end} return {begin, end}
} }
...@@ -450,7 +450,7 @@ function coordsCharInner(cm, lineObj, lineNo, x, y) { ...@@ -450,7 +450,7 @@ function coordsCharInner(cm, lineObj, lineNo, x, y) {
prevDiff = diff prevDiff = diff
let prevPos = pos let prevPos = pos
pos = moveVisually(cm, lineObj, pos, dir) pos = moveVisually(cm, lineObj, pos, dir)
if (pos == null || pos.ch < begin || end <= pos.ch) { if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
pos = prevPos pos = prevPos
break break
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment