MCPcopy
hub / github.com/csev/py4e / getBidi

Function getBidi

tools/pythonauto/static/codemirrorepl/codemirror.js:1722–1735  ·  view source on GitHub ↗
(ch, partPos)

Source from the content-addressed store, hash-verified

1720 return intoCoordSystem(cm, lineObj, m, context);
1721 }
1722 function getBidi(ch, partPos) {
1723 var part = order[partPos], right = part.level % 2;
1724 if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
1725 part = order[--partPos];
1726 ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
1727 right = true;
1728 } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
1729 part = order[++partPos];
1730 ch = bidiLeft(part) - part.level % 2;
1731 right = false;
1732 }
1733 if (right && ch == part.to && ch > part.from) return get(ch - 1);
1734 return get(ch, right);
1735 }
1736 var order = getOrder(lineObj), ch = pos.ch;
1737 if (!order) return get(ch);
1738 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