MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / offsetToPosition

Function offsetToPosition

src/lib/editorFile.js:58–66  ·  view source on GitHub ↗

* Convert CodeMirror offset to Ace position {row, column}

(offset, doc)

Source from the content-addressed store, hash-verified

56 * Convert CodeMirror offset to Ace position {row, column}
57 */
58 function offsetToPosition(offset, doc) {
59 if (!doc) return { row: 0, column: 0 };
60 try {
61 const line = doc.lineAt(offset);
62 return { row: line.number - 1, column: offset - line.from };
63 } catch (_) {
64 return { row: 0, column: 0 };
65 }
66 }
67
68 function recordInactiveEdit() {
69 if (file.markChanged === false) return;

Callers 1

getFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected