MCPcopy Create free account
hub / github.com/breck7/scroll / getBidiPartAt

Function getBidiPartAt

external/.scrollLibs.js:1677–1701  ·  view source on GitHub ↗
(order, ch, sticky)

Source from the content-addressed store, hash-verified

1675
1676 var bidiOther = null
1677 function getBidiPartAt(order, ch, sticky) {
1678 var found
1679 bidiOther = null
1680 for (var i = 0; i < order.length; ++i) {
1681 var cur = order[i]
1682 if (cur.from < ch && cur.to > ch) {
1683 return i
1684 }
1685 if (cur.to == ch) {
1686 if (cur.from != cur.to && sticky == "before") {
1687 found = i
1688 } else {
1689 bidiOther = i
1690 }
1691 }
1692 if (cur.from == ch) {
1693 if (cur.from != cur.to && sticky != "before") {
1694 found = i
1695 } else {
1696 bidiOther = i
1697 }
1698 }
1699 }
1700 return found != null ? found : bidiOther
1701 }
1702
1703 // Bidirectional ordering algorithm
1704 // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm

Callers 4

cursorCoordsFunction · 0.85
moveVisuallyFunction · 0.85
bidiSimplifyFunction · 0.85
posToDOMFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected