* Convert CodeMirror offset to Ace position {row, column}
(offset, doc)
| 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; |