mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Don't wrap on paragraphs (#3094)
Release Notes: - vim: `{` and `}` will no longer wrap around end of file ([#2116](https://github.com/zed-industries/community/issues/2116)).
This commit is contained in:
commit
85b76b1143
@ -3,4 +3,4 @@ xtask = "run --package xtask --"
|
|||||||
|
|
||||||
[build]
|
[build]
|
||||||
# v0 mangling scheme provides more detailed backtraces around closures
|
# v0 mangling scheme provides more detailed backtraces around closures
|
||||||
rustflags = ["-C", "symbol-mangling-version=v0"]
|
rustflags = ["-C", "symbol-mangling-version=v0", "-C", "link-arg=-fuse-ld=/opt/homebrew/Cellar/llvm/16.0.6/bin/ld64.lld"]
|
||||||
|
@ -1333,7 +1333,7 @@ async fn test_move_start_of_paragraph_end_of_paragraph(cx: &mut gpui::TestAppCon
|
|||||||
|
|
||||||
cx.update_editor(|editor, cx| editor.move_to_end_of_paragraph(&MoveToEndOfParagraph, cx));
|
cx.update_editor(|editor, cx| editor.move_to_end_of_paragraph(&MoveToEndOfParagraph, cx));
|
||||||
cx.assert_editor_state(
|
cx.assert_editor_state(
|
||||||
&r#"ˇone
|
&r#"one
|
||||||
two
|
two
|
||||||
|
|
||||||
three
|
three
|
||||||
@ -1344,9 +1344,22 @@ async fn test_move_start_of_paragraph_end_of_paragraph(cx: &mut gpui::TestAppCon
|
|||||||
.unindent(),
|
.unindent(),
|
||||||
);
|
);
|
||||||
|
|
||||||
cx.update_editor(|editor, cx| editor.move_to_end_of_paragraph(&MoveToEndOfParagraph, cx));
|
cx.update_editor(|editor, cx| editor.move_to_start_of_paragraph(&MoveToStartOfParagraph, cx));
|
||||||
cx.assert_editor_state(
|
cx.assert_editor_state(
|
||||||
&r#"ˇone
|
&r#"one
|
||||||
|
two
|
||||||
|
|
||||||
|
three
|
||||||
|
four
|
||||||
|
five
|
||||||
|
ˇ
|
||||||
|
six"#
|
||||||
|
.unindent(),
|
||||||
|
);
|
||||||
|
|
||||||
|
cx.update_editor(|editor, cx| editor.move_to_start_of_paragraph(&MoveToStartOfParagraph, cx));
|
||||||
|
cx.assert_editor_state(
|
||||||
|
&r#"one
|
||||||
two
|
two
|
||||||
ˇ
|
ˇ
|
||||||
three
|
three
|
||||||
@ -1366,32 +1379,6 @@ async fn test_move_start_of_paragraph_end_of_paragraph(cx: &mut gpui::TestAppCon
|
|||||||
four
|
four
|
||||||
five
|
five
|
||||||
|
|
||||||
sixˇ"#
|
|
||||||
.unindent(),
|
|
||||||
);
|
|
||||||
|
|
||||||
cx.update_editor(|editor, cx| editor.move_to_start_of_paragraph(&MoveToStartOfParagraph, cx));
|
|
||||||
cx.assert_editor_state(
|
|
||||||
&r#"one
|
|
||||||
two
|
|
||||||
|
|
||||||
three
|
|
||||||
four
|
|
||||||
five
|
|
||||||
ˇ
|
|
||||||
sixˇ"#
|
|
||||||
.unindent(),
|
|
||||||
);
|
|
||||||
|
|
||||||
cx.update_editor(|editor, cx| editor.move_to_start_of_paragraph(&MoveToStartOfParagraph, cx));
|
|
||||||
cx.assert_editor_state(
|
|
||||||
&r#"one
|
|
||||||
two
|
|
||||||
ˇ
|
|
||||||
three
|
|
||||||
four
|
|
||||||
five
|
|
||||||
ˇ
|
|
||||||
six"#
|
six"#
|
||||||
.unindent(),
|
.unindent(),
|
||||||
);
|
);
|
||||||
|
@ -234,7 +234,7 @@ pub fn start_of_paragraph(
|
|||||||
) -> DisplayPoint {
|
) -> DisplayPoint {
|
||||||
let point = display_point.to_point(map);
|
let point = display_point.to_point(map);
|
||||||
if point.row == 0 {
|
if point.row == 0 {
|
||||||
return map.max_point();
|
return DisplayPoint::zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut found_non_blank_line = false;
|
let mut found_non_blank_line = false;
|
||||||
@ -261,7 +261,7 @@ pub fn end_of_paragraph(
|
|||||||
) -> DisplayPoint {
|
) -> DisplayPoint {
|
||||||
let point = display_point.to_point(map);
|
let point = display_point.to_point(map);
|
||||||
if point.row == map.max_buffer_row() {
|
if point.row == map.max_buffer_row() {
|
||||||
return DisplayPoint::zero();
|
return map.max_point();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut found_non_blank_line = false;
|
let mut found_non_blank_line = false;
|
||||||
|
@ -652,3 +652,28 @@ async fn test_selection_goal(cx: &mut gpui::TestAppContext) {
|
|||||||
Lorem Ipsum"})
|
Lorem Ipsum"})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[gpui::test]
|
||||||
|
async fn test_paragraphs_dont_wrap(cx: &mut gpui::TestAppContext) {
|
||||||
|
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||||
|
|
||||||
|
cx.set_shared_state(indoc! {"
|
||||||
|
one
|
||||||
|
ˇ
|
||||||
|
two"})
|
||||||
|
.await;
|
||||||
|
|
||||||
|
cx.simulate_shared_keystrokes(["}", "}"]).await;
|
||||||
|
cx.assert_shared_state(indoc! {"
|
||||||
|
one
|
||||||
|
|
||||||
|
twˇo"})
|
||||||
|
.await;
|
||||||
|
|
||||||
|
cx.simulate_shared_keystrokes(["{", "{", "{"]).await;
|
||||||
|
cx.assert_shared_state(indoc! {"
|
||||||
|
ˇone
|
||||||
|
|
||||||
|
two"})
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
8
crates/vim/test_data/test_paragraphs_dont_wrap.json
Normal file
8
crates/vim/test_data/test_paragraphs_dont_wrap.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{"Put":{"state":"one\nˇ\ntwo"}}
|
||||||
|
{"Key":"}"}
|
||||||
|
{"Key":"}"}
|
||||||
|
{"Get":{"state":"one\n\ntwˇo","mode":"Normal"}}
|
||||||
|
{"Key":"{"}
|
||||||
|
{"Key":"{"}
|
||||||
|
{"Key":"{"}
|
||||||
|
{"Get":{"state":"ˇone\n\ntwo","mode":"Normal"}}
|
Loading…
Reference in New Issue
Block a user