mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 16:39:38 +08:00
reader: Only maintain cursor position in non-empty prefix search
Otherwise this would always move the cursor to the beginning. Fixes #11133
This commit is contained in:
parent
3469fd25ec
commit
db244e0492
@ -1671,7 +1671,7 @@ impl ReaderData {
|
||||
0..self.command_line.len(),
|
||||
new_text,
|
||||
);
|
||||
if self.history_search.by_prefix() {
|
||||
if self.history_search.by_prefix() && !self.history_search.search_string().is_empty() {
|
||||
self.command_line
|
||||
.set_position(self.history_search.search_string().len());
|
||||
}
|
||||
|
@ -364,6 +364,14 @@ send('\x02\x02\x02') # ctrl-b, backward-char
|
||||
sendline('\x1bu') # alt+u, upcase word
|
||||
expect_prompt("fooBAR")
|
||||
|
||||
sendline('bind ctrl-z history-prefix-search-backward')
|
||||
expect_prompt()
|
||||
sendline("echo this continues")
|
||||
expect_prompt()
|
||||
send("\x1A")
|
||||
sendline(" with this text")
|
||||
expect_prompt("this continues with this text")
|
||||
|
||||
sendline("""
|
||||
bind ctrl-g "
|
||||
commandline --insert 'echo foo ar'
|
||||
|
Loading…
x
Reference in New Issue
Block a user