MCPcopy
hub / github.com/witheve/Eve / cursorCoords

Function cursorCoords

src/codemirror.js:2837–2865  ·  view source on GitHub ↗
(cm, pos, context, lineObj, preparedMeasure, varHeight)

Source from the content-addressed store, hash-verified

2835 // 'other' property containing the position of the secondary cursor
2836 // on a bidi boundary.
2837 function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
2838 lineObj = lineObj || getLine(cm.doc, pos.line);
2839 if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj);
2840 function get(ch, right) {
2841 var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
2842 if (right) m.left = m.right; else m.right = m.left;
2843 return intoCoordSystem(cm, lineObj, m, context);
2844 }
2845 function getBidi(ch, partPos) {
2846 var part = order[partPos], right = part.level % 2;
2847 if (ch == bidiLeft(part) && partPos && part.level < order[partPos - 1].level) {
2848 part = order[--partPos];
2849 ch = bidiRight(part) - (part.level % 2 ? 0 : 1);
2850 right = true;
2851 } else if (ch == bidiRight(part) && partPos < order.length - 1 && part.level < order[partPos + 1].level) {
2852 part = order[++partPos];
2853 ch = bidiLeft(part) - part.level % 2;
2854 right = false;
2855 }
2856 if (right && ch == part.to && ch > part.from) return get(ch - 1);
2857 return get(ch, right);
2858 }
2859 var order = getOrder(lineObj), ch = pos.ch;
2860 if (!order) return get(ch);
2861 var partPos = getBidiPartAt(order, ch);
2862 var val = getBidi(ch, partPos);
2863 if (bidiOther != null) val.other = getBidi(ch, bidiOther);
2864 return val;
2865 }
2866
2867 // Used to cheaply estimate the coordinates for a position. Used for
2868 // intermediate scroll updates.

Callers 4

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

Calls 6

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

Tested by

no test coverage detected