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

Function getBidi

static/mergely/lib/codemirror.js:2837–2850  ·  view source on GitHub ↗
(ch, partPos)

Source from the content-addressed store, hash-verified

2835 return intoCoordSystem(cm, lineObj, m, context);
2836 }
2837 function getBidi(ch, partPos) {
2838 var part = order[partPos], right = part.level % 2;
2839 if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
2840 part = order[--partPos];
2841 ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
2842 right = true;
2843 } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
2844 part = order[++partPos];
2845 ch = bidiLeft(part) - part.level % 2;
2846 right = false;
2847 }
2848 if (right && ch == part.to && ch > part.from) return get(ch - 1);
2849 return get(ch, right);
2850 }
2851 var order = getOrder(lineObj), ch = pos.ch;
2852 if (!order) return get(ch);
2853 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