Revert d/c j and k binding special casing
This commit is contained in:
parent
63278041e1
commit
dd25ab5798
1 changed files with 4 additions and 29 deletions
|
@ -33,18 +33,7 @@ fn change_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) {
|
||||||
editor.set_clip_at_line_ends(false, cx);
|
editor.set_clip_at_line_ends(false, cx);
|
||||||
editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection));
|
editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection));
|
||||||
editor.set_clip_at_line_ends(true, cx);
|
editor.set_clip_at_line_ends(true, cx);
|
||||||
match motion {
|
editor.insert(&"", cx);
|
||||||
Motion::Up => editor.insert(&"\n", cx),
|
|
||||||
Motion::Down => editor.insert(&"\n", cx),
|
|
||||||
_ => editor.insert(&"", cx),
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Motion::Up = motion {
|
|
||||||
// Position cursor on previous line after change
|
|
||||||
editor.move_cursors(cx, |map, cursor, goal| {
|
|
||||||
Motion::Up.move_point(map, cursor, goal)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
vim.switch_mode(Mode::Insert, cx)
|
vim.switch_mode(Mode::Insert, cx)
|
||||||
|
@ -56,18 +45,8 @@ fn delete_over(vim: &mut Vim, motion: Motion, cx: &mut MutableAppContext) {
|
||||||
// Don't clip at line ends during delete operation
|
// Don't clip at line ends during delete operation
|
||||||
editor.set_clip_at_line_ends(false, cx);
|
editor.set_clip_at_line_ends(false, cx);
|
||||||
editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection));
|
editor.move_selections(cx, |map, selection| motion.expand_selection(map, selection));
|
||||||
match motion {
|
editor.insert(&"", cx);
|
||||||
Motion::Up => editor.insert(&"\n", cx),
|
|
||||||
Motion::Down => editor.insert(&"\n", cx),
|
|
||||||
_ => editor.insert(&"", cx),
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Motion::Up = motion {
|
|
||||||
// Position cursor on previous line after change
|
|
||||||
editor.move_cursors(cx, |map, cursor, goal| {
|
|
||||||
Motion::Up.move_point(map, cursor, goal)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Fixup cursor position after the deletion
|
// Fixup cursor position after the deletion
|
||||||
editor.set_clip_at_line_ends(true, cx);
|
editor.set_clip_at_line_ends(true, cx);
|
||||||
editor.move_selection_heads(cx, |map, head, _| {
|
editor.move_selection_heads(cx, |map, head, _| {
|
||||||
|
@ -410,8 +389,7 @@ mod test {
|
||||||
The quick
|
The quick
|
||||||
brown |fox"},
|
brown |fox"},
|
||||||
indoc! {"
|
indoc! {"
|
||||||
|
|
|"},
|
||||||
"},
|
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
assert(
|
assert(
|
||||||
|
@ -420,7 +398,6 @@ mod test {
|
||||||
The q|uick
|
The q|uick
|
||||||
brown fox"},
|
brown fox"},
|
||||||
indoc! {"
|
indoc! {"
|
||||||
|
|
||||||
|"},
|
|"},
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
@ -498,8 +475,7 @@ mod test {
|
||||||
The quick
|
The quick
|
||||||
brown |fox"},
|
brown |fox"},
|
||||||
indoc! {"
|
indoc! {"
|
||||||
|
|
|"},
|
||||||
"},
|
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
assert(
|
assert(
|
||||||
|
@ -508,7 +484,6 @@ mod test {
|
||||||
The q|uick
|
The q|uick
|
||||||
brown fox"},
|
brown fox"},
|
||||||
indoc! {"
|
indoc! {"
|
||||||
|
|
||||||
|"},
|
|"},
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue