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

Function getBidiPartAt

static/mergely/lib/codemirror.js:8654–8672  ·  view source on GitHub ↗
(order, pos)

Source from the content-addressed store, hash-verified

8652 }
8653 var bidiOther;
8654 function getBidiPartAt(order, pos) {
8655 bidiOther = null;
8656 for (var i = 0, found; i < order.length; ++i) {
8657 var cur = order[i];
8658 if (cur.from < pos && cur.to > pos) return i;
8659 if ((cur.from == pos || cur.to == pos)) {
8660 if (found == null) {
8661 found = i;
8662 } else if (compareBidiLevel(order, cur.level, order[found].level)) {
8663 if (cur.from != cur.to) bidiOther = found;
8664 return i;
8665 } else {
8666 if (cur.from != cur.to) bidiOther = i;
8667 return found;
8668 }
8669 }
8670 }
8671 return found;
8672 }
8673
8674 function moveInLine(line, pos, dir, byUnit) {
8675 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