mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 05:53:59 +00:00
reader: Fix infinite loop for up/downcase bindings
This could *probably* be rewritten nicer with a for-loop Fixes #10222
This commit is contained in:
parent
5d3aea363e
commit
34c09b1816
2 changed files with 7 additions and 1 deletions
|
@ -2795,7 +2795,7 @@ impl ReaderData {
|
|||
let mut capitalized_first = false;
|
||||
|
||||
// We apply the operation from the current location to the end of the word.
|
||||
let pos = el.position();
|
||||
let mut pos = el.position();
|
||||
let init_pos = pos;
|
||||
self.move_word(
|
||||
elt,
|
||||
|
@ -2824,6 +2824,7 @@ impl ReaderData {
|
|||
replacement.extend(chr.to_lowercase());
|
||||
};
|
||||
capitalized_first = capitalized_first || make_uppercase;
|
||||
pos = pos + 1;
|
||||
}
|
||||
self.replace_substring(elt, init_pos..pos, replacement);
|
||||
self.update_buff_pos(elt, None);
|
||||
|
|
|
@ -375,6 +375,11 @@ expect_prompt()
|
|||
send("\x1A")
|
||||
expect_str("bound ctrl-z")
|
||||
|
||||
send('echo foobar')
|
||||
send('\x02\x02\x02') # ctrl-b, backward-char
|
||||
sendline('\x1bu') # alt+u, upcase word
|
||||
expect_prompt("fooBAR")
|
||||
|
||||
# Check that the builtin version of `exit` works
|
||||
# (for obvious reasons this MUST BE LAST)
|
||||
sendline("function myexit; echo exit; exit; end; bind \cz myexit")
|
||||
|
|
Loading…
Reference in a new issue