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

Function iterateBidiSections

tools/pythonauto/static/codemirrorepl/codemirror.js:7185–7196  ·  view source on GitHub ↗
(order, from, to, f)

Source from the content-addressed store, hash-verified

7183 // BIDI HELPERS
7184
7185 function iterateBidiSections(order, from, to, f) {
7186 if (!order) return f(from, to, "ltr");
7187 var found = false;
7188 for (var i = 0; i < order.length; ++i) {
7189 var part = order[i];
7190 if (part.from < to && part.to > from || from == to && part.to == from) {
7191 f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
7192 found = true;
7193 }
7194 }
7195 if (!found) f(from, to, "ltr");
7196 }
7197
7198 function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }
7199 function bidiRight(part) { return part.level % 2 ? part.from : part.to; }

Callers 1

drawForLineFunction · 0.70

Calls 1

fFunction · 0.50

Tested by

no test coverage detected