Fix regression when erasing word in search field

This fixes a crash introduced in the reader port.

The tmux tests are not great but at least easy to write.
This commit is contained in:
Johannes Altmanninger 2024-01-26 18:26:39 +01:00
parent 9ac5e79e46
commit 1b9e5258b5
2 changed files with 9 additions and 1 deletions

View File

@ -1573,7 +1573,7 @@ impl ReaderData {
let mut buff_pos = el.position();
while buff_pos != boundary {
let idx = if move_right { buff_pos } else { buff_pos - 1 };
let c = self.command_line.at(idx);
let c = el.at(idx);
if !state.consume_char(c) {
break;
}

View File

@ -34,3 +34,11 @@ tmux-sleep
isolated-tmux send-keys Enter
# CHECK: prompt 2> echo no such command in history
isolated-tmux capture-pane -p | grep 'prompt 2'
isolated-tmux send-keys C-c
isolated-tmux send-keys C-r hay/shmay
isolated-tmux send-keys C-w C-h
isolated-tmux send-keys Enter
# CHECK: prompt 2> true hay ee hay
isolated-tmux capture-pane -p | grep 'prompt 2>'
isolated-tmux send-keys C-c