mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 12:04:39 +08:00
Fix restoring cursor position on redo with edit groups
This commit is contained in:
parent
d1a4b4bc73
commit
edb5cb7226
|
@ -278,7 +278,8 @@ impl EditableLine {
|
|||
last_group_id = edit.group_id;
|
||||
self.undo_history.edits_applied += 1;
|
||||
apply_edit(&mut self.text, &mut self.colors, edit);
|
||||
self.set_position(edit.cursor_position_before_undo.unwrap());
|
||||
edit.cursor_position_before_undo
|
||||
.map(|pos| self.set_position(pos));
|
||||
did_redo = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,5 +24,20 @@ expect_str("echo word")
|
|||
send("Undo")
|
||||
expect_str("echo")
|
||||
|
||||
send("Redo")
|
||||
send("Redo\r")
|
||||
expect_str("echo word")
|
||||
|
||||
sendline("bind x begin-undo-group 'commandline -i \"+ \"' 'commandline -i 3' end-undo-group")
|
||||
send("math 2 x\r")
|
||||
expect_prompt("5")
|
||||
|
||||
send("math 4x")
|
||||
send("Undo1\r")
|
||||
expect_prompt("41")
|
||||
|
||||
send("math 5 x")
|
||||
send("\x02") # c-b, moving before the 3
|
||||
send("Undo")
|
||||
send("Redo")
|
||||
send("9\r") # 5 + 93
|
||||
expect_prompt("98")
|
||||
|
|
Loading…
Reference in New Issue
Block a user