this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Read canonical doc from CodeMirror after set_doc

set_source now reads back the document from CodeMirror's state
after setting it, rather than using the raw string from textContent.
This ensures current_doc matches CodeMirror's internal representation,
which may differ due to line ending normalization or HTML entity
handling.

The HTML textContent can be 2 characters longer than what CodeMirror
stores internally, causing RangeError when lint diagnostic positions
(computed relative to the raw string) exceed CodeMirror's doc length.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+6 -2
+6 -2
src/editor.ml
··· 175 175 let add_message t loc msg = set_messages t ((loc, msg) :: t.messages) 176 176 177 177 let set_source t doc = 178 - set_current_doc t doc; 179 - Code_mirror.Editor.View.set_doc t.view (Jstr.of_string doc) 178 + Code_mirror.Editor.View.set_doc t.view (Jstr.of_string doc); 179 + (* Read back from CodeMirror to get the canonical form — the raw 180 + string may differ (e.g., HTML entity decoding, line ending 181 + normalization) from what CodeMirror stores internally. *) 182 + let canonical = source t in 183 + set_current_doc t canonical