MCPcopy Create free account
hub / github.com/TruthHun/BookStack / getBidiPartAt

Function getBidiPartAt

static/editor.md/lib/codemirror/lib/codemirror.js:8411–8429  ·  view source on GitHub ↗
(order, pos)

Source from the content-addressed store, hash-verified

8409 }
8410 var bidiOther;
8411 function getBidiPartAt(order, pos) {
8412 bidiOther = null;
8413 for (var i = 0, found; i < order.length; ++i) {
8414 var cur = order[i];
8415 if (cur.from < pos && cur.to > pos) return i;
8416 if ((cur.from == pos || cur.to == pos)) {
8417 if (found == null) {
8418 found = i;
8419 } else if (compareBidiLevel(order, cur.level, order[found].level)) {
8420 if (cur.from != cur.to) bidiOther = found;
8421 return i;
8422 } else {
8423 if (cur.from != cur.to) bidiOther = i;
8424 return found;
8425 }
8426 }
8427 }
8428 return found;
8429 }
8430
8431 function moveInLine(line, pos, dir, byUnit) {
8432 if (!byUnit) return pos + dir;

Callers 3

posToDOMFunction · 0.70
cursorCoordsFunction · 0.70
moveVisuallyFunction · 0.70

Calls 1

compareBidiLevelFunction · 0.70

Tested by

no test coverage detected