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>