vim: Add Multi Replace mode in Vim (#8469)

For #4440, I've only added support for normal, if it's visual mode,
would we like this to delete the current selection row and enter insert
mode?

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
Hans 2024-03-15 10:31:53 +08:00 committed by GitHub
parent 72d36d0213
commit e836a979a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 584 additions and 16 deletions

View file

@ -387,7 +387,7 @@ pub(crate) fn motion(motion: Motion, cx: &mut WindowContext) {
let count = Vim::update(cx, |vim, cx| vim.take_count(cx));
let operator = Vim::read(cx).active_operator();
match Vim::read(cx).state().mode {
Mode::Normal => normal_motion(motion, operator, count, cx),
Mode::Normal | Mode::Replace => normal_motion(motion, operator, count, cx),
Mode::Visual | Mode::VisualLine | Mode::VisualBlock => visual_motion(motion, count, cx),
Mode::Insert => {
// Shouldn't execute a motion in insert mode. Ignoring
@ -800,7 +800,11 @@ fn left(map: &DisplaySnapshot, mut point: DisplayPoint, times: usize) -> Display
point
}
fn backspace(map: &DisplaySnapshot, mut point: DisplayPoint, times: usize) -> DisplayPoint {
pub(crate) fn backspace(
map: &DisplaySnapshot,
mut point: DisplayPoint,
times: usize,
) -> DisplayPoint {
for _ in 0..times {
point = movement::left(map, point);
if point.is_zero() {