MCPcopy Index your code
hub / github.com/csev/py4e / coordsChar

Function coordsChar

tools/pythonauto/static/codemirror/codemirror.js:1259–1278  ·  view source on GitHub ↗
(cm, x, y)

Source from the content-addressed store, hash-verified

1257
1258 // Coords must be lineSpace-local
1259 function coordsChar(cm, x, y) {
1260 var doc = cm.doc;
1261 y += cm.display.viewOffset;
1262 if (y < 0) return PosWithInfo(doc.first, 0, true, -1);
1263 var lineNo = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
1264 if (lineNo > last)
1265 return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);
1266 if (x < 0) x = 0;
1267
1268 for (;;) {
1269 var lineObj = getLine(doc, lineNo);
1270 var found = coordsCharInner(cm, lineObj, lineNo, x, y);
1271 var merged = collapsedSpanAtEnd(lineObj);
1272 var mergedPos = merged && merged.find();
1273 if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
1274 lineNo = mergedPos.to.line;
1275 else
1276 return found;
1277 }
1278 }
1279
1280 function coordsCharInner(cm, lineObj, lineNo, x, y) {
1281 var innerOff = y - heightAtLine(cm, lineObj);

Callers 3

posFromMouseFunction · 0.70
findPosVFunction · 0.70
codemirror.jsFile · 0.70

Calls 6

PosWithInfoFunction · 0.70
lineAtHeightFunction · 0.70
getLineFunction · 0.70
coordsCharInnerFunction · 0.70
collapsedSpanAtEndFunction · 0.70
findMethod · 0.45

Tested by

no test coverage detected