mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-31 20:14:16 +08: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
|
@ -2795,7 +2795,7 @@ impl ReaderData {
|
||||||
let mut capitalized_first = false;
|
let mut capitalized_first = false;
|
||||||
|
|
||||||
// We apply the operation from the current location to the end of the word.
|
// 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;
|
let init_pos = pos;
|
||||||
self.move_word(
|
self.move_word(
|
||||||
elt,
|
elt,
|
||||||
|
@ -2824,6 +2824,7 @@ impl ReaderData {
|
||||||
replacement.extend(chr.to_lowercase());
|
replacement.extend(chr.to_lowercase());
|
||||||
};
|
};
|
||||||
capitalized_first = capitalized_first || make_uppercase;
|
capitalized_first = capitalized_first || make_uppercase;
|
||||||
|
pos = pos + 1;
|
||||||
}
|
}
|
||||||
self.replace_substring(elt, init_pos..pos, replacement);
|
self.replace_substring(elt, init_pos..pos, replacement);
|
||||||
self.update_buff_pos(elt, None);
|
self.update_buff_pos(elt, None);
|
||||||
|
|
|
@ -375,6 +375,11 @@ expect_prompt()
|
||||||
send("\x1A")
|
send("\x1A")
|
||||||
expect_str("bound ctrl-z")
|
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
|
# Check that the builtin version of `exit` works
|
||||||
# (for obvious reasons this MUST BE LAST)
|
# (for obvious reasons this MUST BE LAST)
|
||||||
sendline("function myexit; echo exit; exit; end; bind \cz myexit")
|
sendline("function myexit; echo exit; exit; end; bind \cz myexit")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user