mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +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 <121003585+ntbang0901@users.noreply.github.com>
25 lines
797 B
TOML
25 lines
797 B
TOML
[package]
|
|
name = "ide-text"
|
|
description = "Rope-backed documents, change sets and UTF-16/byte coordinate conversion"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
|
|
[dependencies]
|
|
ide-core.workspace = true
|
|
# Only `\n` may count as a line break: documents are normalized to `\n`, and
|
|
# CodeMirror / LSP do not treat VT, FF, NEL, U+2028 or U+2029 as line breaks.
|
|
# Hence no `unicode_lines` / `cr_lines` (a test guards against feature unification).
|
|
ropey = { version = "1.6", default-features = false, features = ["simd"] }
|
|
serde.workspace = true
|
|
similar = { version = "2.7", default-features = false }
|
|
specta.workspace = true
|
|
|
|
[dev-dependencies]
|
|
proptest.workspace = true
|
|
criterion = { version = "0.5", default-features = false }
|
|
|
|
[[bench]]
|
|
name = "text"
|
|
harness = false
|