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

Function getBidi

static/editor.md/lib/codemirror/lib/codemirror.js:2731–2744  ·  view source on GitHub ↗
(ch, partPos)

Source from the content-addressed store, hash-verified

2729 return intoCoordSystem(cm, lineObj, m, context);
2730 }
2731 function getBidi(ch, partPos) {
2732 var part = order[partPos], right = part.level % 2;
2733 if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
2734 part = order[--partPos];
2735 ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
2736 right = true;
2737 } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
2738 part = order[++partPos];
2739 ch = bidiLeft(part) - part.level % 2;
2740 right = false;
2741 }
2742 if (right && ch == part.to && ch > part.from) return get(ch - 1);
2743 return get(ch, right);
2744 }
2745 var order = getOrder(lineObj), ch = pos.ch;
2746 if (!order) return get(ch);
2747 var partPos = getBidiPartAt(order, ch);

Callers 1

cursorCoordsFunction · 0.70

Calls 3

bidiLeftFunction · 0.70
bidiRightFunction · 0.70
getFunction · 0.70

Tested by

no test coverage detected