This PR reworks the (still feature-gated) side-by-side diff view to use a different approach to representing the multibuffers on the left- and right-hand sides. Previously, these two multibuffers used identical sets of buffers and excerpts, and were made to behave differently by adding a new knob to the multibuffer controlling how diffs are displayed. Specifically, the left-hand side multibuffer would filter out the added range of each hunk from the excerpts using a new `FilteredInsertedHunk` diff transform, and the right-hand side would simply not show the deleted sides of expanded hunks. This approach has some problems: - Line numbers, and actions that navigate by line number, behaved incorrectly for the left-hand side. - Syntax highlighting and other features that use the buffer syntax tree also behaved incorrectly for the left-hand side. In this PR, we've switched to using independent buffers to build the left-hand side. These buffers are constructed using the base texts for the corresponding diffs, and their lifecycle is managed by `BufferDiff`. The red "deleted" regions on the left-hand side are represented by `BufferContent` diff transforms, not `DeletedHunk` transforms. This means each excerpt on the left represents a contiguous slice of a single buffer, which fixes the above issues by construction. The tradeoff with this new approach is that we now have to manually synchronize excerpt ranges from the right side to the left, which we do using `BufferDiffSnapshot::row_to_base_text_row`. Release Notes: - N/A --------- Co-authored-by: cameron <cameron.studdstreet@gmail.com> Co-authored-by: HactarCE <6060305+HactarCE@users.noreply.github.com> Co-authored-by: Miguel Raz Guzmán Macedo <miguel@zed.dev> Co-authored-by: Anthony <anthony@zed.dev> Co-authored-by: Cameron <cameron@zed.dev>
40 lines
840 B
TOML
40 lines
840 B
TOML
[package]
|
|
name = "buffer_diff"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
publish.workspace = true
|
|
license = "GPL-3.0-or-later"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
path = "src/buffer_diff.rs"
|
|
|
|
[features]
|
|
test-support = ["settings"]
|
|
|
|
[dependencies]
|
|
clock.workspace = true
|
|
futures.workspace = true
|
|
git2.workspace = true
|
|
gpui.workspace = true
|
|
language.workspace = true
|
|
log.workspace = true
|
|
pretty_assertions.workspace = true
|
|
rope.workspace = true
|
|
settings = { workspace = true, optional = true }
|
|
sum_tree.workspace = true
|
|
text.workspace = true
|
|
util.workspace = true
|
|
|
|
[dev-dependencies]
|
|
ctor.workspace = true
|
|
gpui = { workspace = true, features = ["test-support"] }
|
|
rand.workspace = true
|
|
serde_json.workspace = true
|
|
settings.workspace = true
|
|
text = { workspace = true, features = ["test-support"] }
|
|
unindent.workspace = true
|
|
zlog.workspace = true
|