MCPcopy Create free account
hub / github.com/sql-js/sql.js / cursorCoords

Function cursorCoords

GUI/codemirror/lib/codemirror.js:1730–1758  ·  view source on GitHub ↗
(cm, pos, context, lineObj, preparedMeasure)

Source from the content-addressed store, hash-verified

1728 // 'other' property containing the position of the secondary cursor
1729 // on a bidi boundary.
1730 function cursorCoords(cm, pos, context, lineObj, preparedMeasure) {
1731 lineObj = lineObj || getLine(cm.doc, pos.line);
1732 if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);
1733 function get(ch, right) {
1734 var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left");
1735 if (right) m.left = m.right; else m.right = m.left;
1736 return intoCoordSystem(cm, lineObj, m, context);
1737 }
1738 function getBidi(ch, partPos) {
1739 var part = order[partPos], right = part.level % 2;
1740 if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
1741 part = order[--partPos];
1742 ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
1743 right = true;
1744 } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
1745 part = order[++partPos];
1746 ch = bidiLeft(part) - part.level % 2;
1747 right = false;
1748 }
1749 if (right && ch == part.to && ch > part.from) return get(ch - 1);
1750 return get(ch, right);
1751 }
1752 var order = getOrder(lineObj), ch = pos.ch;
1753 if (!order) return get(ch);
1754 var partPos = getBidiPartAt(order, ch);
1755 var val = getBidi(ch, partPos);
1756 if (bidiOther != null) val.other = getBidi(ch, bidiOther);
1757 return val;
1758 }
1759
1760 // Used to cheaply estimate the coordinates for a position. Used for
1761 // intermediate scroll updates.

Callers 5

updateSelectionFunction · 0.85
drawSelectionCursorFunction · 0.85
getXFunction · 0.85
scrollPosIntoViewFunction · 0.85
codemirror.jsFile · 0.85

Calls 6

getLineFunction · 0.85
prepareMeasureForLineFunction · 0.85
getOrderFunction · 0.85
getFunction · 0.85
getBidiPartAtFunction · 0.85
getBidiFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…