Skip to content

Commit

Permalink
Fix regression when erasing word in search field
Browse files Browse the repository at this point in the history
This fixes a crash introduced in the reader port.

The tmux tests are not great but at least easy to write.
  • Loading branch information
krobelus committed Jan 27, 2024
1 parent 9ac5e79 commit 1b9e525
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 8 additions & 0 deletions tests/checks/tmux-history-search.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1b9e525

Please sign in to comment.