mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:33 +00:00
Document::diff only trimmed the common prefix and suffix, so two distant edits on disk became one change spanning everything between them. The caret and scroll position inside that span were mapped to its start, which made the editor jump to the first edit after an agent, formatter or git operation rewrote the file. Diff the changed middle line by line (Myers via similar, 50 ms deadline with a coarser fallback) and emit one change per edited region, trimmed to its differing characters. The frontend DocSync path produces the same per-region changes, so external reloads, local history restores and formatting keep the caret and view in place. Closes #1326 Co-authored-by: ntbang0901 <[email protected]>