Rework diff rendering to allow putting the cursor into deleted text, soft-wrapping and scrolling deleted text correctly (#22994)
Closes #12553 * [x] Fix `diff_hunk_before` * [x] Fix failure to show deleted text when expanding hunk w/ cursor on second line of the hunk * [x] Failure to expand diff hunk below the cursor. * [x] Delete the whole file, and expand the diff. Backspace over the deleted hunk, panic! * [x] Go-to-line now counts the diff hunks, but it should not * [x] backspace at the beginning of a deleted hunk deletes too much text * [x] Indent guides are rendered incorrectly * [ ] Fix randomized multi buffer tests Maybe: * [ ] Buffer search should include deleted text (in vim mode it turns out I use `/x` all the time to jump to the next x I can see). * [ ] vim: should refuse to switch into insert mode if selection is fully within a diff. * [ ] vim `o` command when cursor is on last line of deleted hunk. * [ ] vim `shift-o` on first line of deleted hunk moves cursor but doesn't insert line * [x] `enter` at end of diff hunk inserts a new line but doesn't move cursor * [x] (`shift-enter` at start of diff hunk does nothing) * [ ] Inserting a line just before an expanded hunk collapses it Release Notes: - Improved diff rendering, allowing you to navigate with your cursor inside of deleted text in diff hunks. --------- Co-authored-by: Conrad <conrad@zed.dev> Co-authored-by: Cole <cole@zed.dev> Co-authored-by: Mikayla <mikayla@zed.dev> Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Michael <michael@zed.dev> Co-authored-by: Agus <agus@zed.dev> Co-authored-by: João <joao@zed.dev>
This commit is contained in:
parent
1fdae4bae0
commit
d2c55cbe3d
64 changed files with 7653 additions and 5495 deletions
|
@ -1469,7 +1469,7 @@ mod tests {
|
|||
use workspace::{
|
||||
item::{Item, ItemHandle},
|
||||
open_new, open_paths, pane, NewFile, OpenVisible, SaveIntent, SplitDirection,
|
||||
WorkspaceHandle,
|
||||
WorkspaceHandle, SERIALIZATION_THROTTLE_TIME,
|
||||
};
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -2866,7 +2866,9 @@ mod tests {
|
|||
})
|
||||
.unwrap();
|
||||
|
||||
cx.run_until_parked();
|
||||
cx.background_executor
|
||||
.advance_clock(SERIALIZATION_THROTTLE_TIME);
|
||||
cx.update(|_| {});
|
||||
editor_1.assert_released();
|
||||
editor_2.assert_released();
|
||||
buffer.assert_released();
|
||||
|
|
|
@ -6,7 +6,6 @@ use cli::{ipc::IpcSender, CliRequest, CliResponse};
|
|||
use client::parse_zed_link;
|
||||
use collections::HashMap;
|
||||
use db::kvp::KEY_VALUE_STORE;
|
||||
use editor::scroll::Autoscroll;
|
||||
use editor::Editor;
|
||||
use fs::Fs;
|
||||
use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
|
||||
|
@ -14,7 +13,7 @@ use futures::channel::{mpsc, oneshot};
|
|||
use futures::future::join_all;
|
||||
use futures::{FutureExt, SinkExt, StreamExt};
|
||||
use gpui::{AppContext, AsyncAppContext, Global, WindowHandle};
|
||||
use language::{Bias, Point};
|
||||
use language::Point;
|
||||
use recent_projects::{open_ssh_project, SshSettings};
|
||||
use remote::SshConnectionOptions;
|
||||
use settings::Settings;
|
||||
|
@ -236,11 +235,7 @@ pub async fn open_paths_with_positions(
|
|||
workspace
|
||||
.update(cx, |_, cx| {
|
||||
active_editor.update(cx, |editor, cx| {
|
||||
let snapshot = editor.snapshot(cx).display_snapshot;
|
||||
let point = snapshot.buffer_snapshot.clip_point(point, Bias::Left);
|
||||
editor.change_selections(Some(Autoscroll::center()), cx, |s| {
|
||||
s.select_ranges([point..point])
|
||||
});
|
||||
editor.go_to_singleton_buffer_point(point, cx);
|
||||
});
|
||||
})
|
||||
.log_err();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue