mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Fix panic in visual line mode with folds (#10284)
Fixes: #10266 Release Notes: - Added/Fixed/Improved ... ([#<public_issue_number_if_exists>](https://github.com/zed-industries/zed/issues/<public_issue_number_if_exists>)). Optionally, include screenshots / media showcasing your addition that can be included in the release notes. **or** - N/A
This commit is contained in:
parent
56c0345cf3
commit
e826ef83e2
@ -433,7 +433,10 @@ impl DisplaySnapshot {
|
||||
} else if range.start.row == self.max_buffer_row()
|
||||
|| (range.end.column > 0 && range.end.row == self.max_buffer_row())
|
||||
{
|
||||
Point::new(range.start.row - 1, self.line_len(range.start.row - 1))
|
||||
Point::new(
|
||||
range.start.row - 1,
|
||||
self.buffer_snapshot.line_len(range.start.row - 1),
|
||||
)
|
||||
} else {
|
||||
self.prev_line_boundary(range.start).0
|
||||
};
|
||||
|
@ -634,6 +634,25 @@ async fn test_folds_panic(cx: &mut gpui::TestAppContext) {
|
||||
cx.simulate_shared_keystrokes(["g", "g"]).await;
|
||||
cx.simulate_shared_keystrokes(["5", "d", "j"]).await;
|
||||
cx.assert_shared_state(indoc! { "ˇ"}).await;
|
||||
|
||||
cx.set_shared_state(indoc! { "
|
||||
fn boop() {
|
||||
ˇbarp()
|
||||
bazp()
|
||||
}
|
||||
"})
|
||||
.await;
|
||||
cx.simulate_shared_keystrokes(["shift-v", "j", "j", "z", "f"])
|
||||
.await;
|
||||
cx.simulate_shared_keystrokes(["escape"]).await;
|
||||
cx.simulate_shared_keystrokes(["shift-g", "shift-v"]).await;
|
||||
cx.assert_shared_state(indoc! { "
|
||||
fn boop() {
|
||||
barp()
|
||||
bazp()
|
||||
}
|
||||
ˇ"})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
@ -1038,12 +1057,3 @@ async fn test_undo(cx: &mut gpui::TestAppContext) {
|
||||
3"})
|
||||
.await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_command_palette(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = VimTestContext::new(cx, true).await;
|
||||
cx.simulate_keystroke(":");
|
||||
cx.simulate_input("go to definition");
|
||||
assert!(cx.debug_bounds("KEY_BINDING-f12").is_none());
|
||||
assert!(cx.debug_bounds("KEY_BINDING-g d").is_some());
|
||||
}
|
||||
|
@ -11,3 +11,13 @@
|
||||
{"Key":"d"}
|
||||
{"Key":"j"}
|
||||
{"Get":{"state":"ˇ","mode":"Normal"}}
|
||||
{"Put":{"state":"fn boop() {\n ˇbarp()\n bazp()\n}\n"}}
|
||||
{"Key":"shift-v"}
|
||||
{"Key":"j"}
|
||||
{"Key":"j"}
|
||||
{"Key":"z"}
|
||||
{"Key":"f"}
|
||||
{"Key":"escape"}
|
||||
{"Key":"shift-g"}
|
||||
{"Key":"shift-v"}
|
||||
{"Get":{"state":"fn boop() {\n barp()\n bazp()\n}\nˇ","mode":"VisualLine"}}
|
||||
|
Loading…
Reference in New Issue
Block a user