Skip to content

Commit 6a1b928

Browse files
Copilottsnobip
andcommitted
Clarify error position indexing in comments - rows are 1-based, columns are 0-based
Co-authored-by: tsnobip <[email protected]>
1 parent 8311c48 commit 6a1b928

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/CodeMirror.res

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ let createEditor = %raw(`
192192
try {
193193
const doc = view.state.doc;
194194
// Error row/endRow are 1-based (same as CodeMirror 5)
195+
// Error column/endColumn are 0-based (same as CodeMirror 5)
195196
// Validate line numbers are within document bounds
196197
const fromLine = Math.max(1, Math.min(err.row, doc.lines));
197198
const toLine = Math.max(1, Math.min(err.endRow, doc.lines));
@@ -200,7 +201,7 @@ let createEditor = %raw(`
200201
const startLine = doc.line(fromLine);
201202
const endLine = doc.line(toLine);
202203
203-
// Validate column positions are within line bounds
204+
// Validate column positions (0-based) are within line bounds
204205
const fromCol = Math.max(0, Math.min(err.column, startLine.length));
205206
const toCol = Math.max(0, Math.min(err.endColumn, endLine.length));
206207

0 commit comments

Comments
 (0)