@@ -191,13 +191,22 @@ let createEditor = %raw(`
191191return errorsArray .map (err => {
192192try {
193193const doc = view .state .doc ;
194- // Validate line numbers (1-based to 0-based conversion)
194+ // Error row/endRow are 1-based (same as CodeMirror 5)
195+ // Validate line numbers are within document bounds
195196const fromLine = Math .max (1 ,Math .min (err .row ,doc .lines ));
196197const toLine = Math .max (1 ,Math .min (err .endRow ,doc .lines ));
197198
199+ // Get line objects
200+ const startLine = doc .line (fromLine);
201+ const endLine = doc .line (toLine);
202+
203+ // Validate column positions are within line bounds
204+ const fromCol = Math .max (0 ,Math .min (err .column ,startLine .length ));
205+ const toCol = Math .max (0 ,Math .min (err .endColumn ,endLine .length ));
206+
198207return {
199- from: doc . line (fromLine). from + err . column ,
200- to: doc . line (toLine). from + err . endColumn ,
208+ from: startLine . from + fromCol ,
209+ to: endLine . from + toCol ,
201210 severity: err .kind === 0 ? " error" : " warning" ,
202211 message: err .text
203212 };