Skip to content
Snippets Groups Projects
Commit 98b50b67 authored by gwenn's avatar gwenn
Browse files

Fix vi redo

parent d021db76
No related branches found
No related tags found
No related merge requests found
...@@ -168,6 +168,7 @@ pub struct EditState { ...@@ -168,6 +168,7 @@ pub struct EditState {
// numeric arguments: http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC7 // numeric arguments: http://web.mit.edu/gnu/doc/html/rlman_1.html#SEC7
num_args: i16, num_args: i16,
last_cmd: Cmd, // vi only last_cmd: Cmd, // vi only
consecutive_insert: bool,
last_char_search: Option<CharSearch>, // vi only last_char_search: Option<CharSearch>, // vi only
} }
...@@ -178,6 +179,7 @@ impl EditState { ...@@ -178,6 +179,7 @@ impl EditState {
insert: true, insert: true,
num_args: 0, num_args: 0,
last_cmd: Cmd::Noop, last_cmd: Cmd::Noop,
consecutive_insert: false,
last_char_search: None, last_char_search: None,
} }
} }
...@@ -500,6 +502,10 @@ impl EditState { ...@@ -500,6 +502,10 @@ impl EditState {
if cmd.is_repeatable_change() { if cmd.is_repeatable_change() {
self.update_last_cmd(cmd.clone()); self.update_last_cmd(cmd.clone());
} }
self.consecutive_insert = match cmd {
Cmd::SelfInsert(_, _) => true,
_ => false,
};
Ok(cmd) Ok(cmd)
} }
...@@ -686,7 +692,9 @@ impl EditState { ...@@ -686,7 +692,9 @@ impl EditState {
fn update_last_cmd(&mut self, new: Cmd) { fn update_last_cmd(&mut self, new: Cmd) {
// consecutive char inserts are repeatable not only the last one... // consecutive char inserts are repeatable not only the last one...
if let Cmd::SelfInsert(_, c) = new { if !self.consecutive_insert {
self.last_cmd = new;
} else if let Cmd::SelfInsert(_, c) = new {
match self.last_cmd { match self.last_cmd {
Cmd::SelfInsert(_, pc) => { Cmd::SelfInsert(_, pc) => {
let mut text = String::new(); let mut text = String::new();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment