mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 04:58:57 +00:00
Fix off-by-one error in Vi-style upcase-word at commandline end
cursor_selection_mode=inclusive means the commandline position is
bounded by the last character. Fix a loop that fails to account
for this.
Fixes d51f669647
(Vi mode: avoid placing cursor beyond last character,
2024-02-14).
This change looks very odd because if the commandline is like
echo foo.
it makes us try to uppercase the trailing period even though that's
not part of word range. Hopefully this is harmless.
Note that there seem to be more issues remaining, for example Vi-mode
paste leaves the cursor in an out-of-bounds odd position.
Fixes #10952
Closes #10953
Reported-by: Lzu Tao <taolzu@gmail.com>
This commit is contained in:
parent
ca28d0a78f
commit
69f0d960cf
2 changed files with 15 additions and 1 deletions
|
@ -3204,7 +3204,15 @@ impl<'a> Reader<'a> {
|
||||||
);
|
);
|
||||||
let (elt, el) = self.active_edit_line();
|
let (elt, el) = self.active_edit_line();
|
||||||
let mut replacement = WString::new();
|
let mut replacement = WString::new();
|
||||||
while pos < el.position() {
|
while pos
|
||||||
|
< if self.cursor_selection_mode == CursorSelectionMode::Inclusive
|
||||||
|
&& self.is_at_end(el)
|
||||||
|
{
|
||||||
|
el.len()
|
||||||
|
} else {
|
||||||
|
el.position()
|
||||||
|
}
|
||||||
|
{
|
||||||
let chr = el.text().as_char_slice()[pos];
|
let chr = el.text().as_char_slice()[pos];
|
||||||
|
|
||||||
// We always change the case; this decides whether we go uppercase (true) or
|
// We always change the case; this decides whether we go uppercase (true) or
|
||||||
|
|
|
@ -241,6 +241,12 @@ expect_prompt("foo")
|
||||||
# send("hh~~bbve~\r")
|
# send("hh~~bbve~\r")
|
||||||
# expect_prompt(TO_END + "SOME TeXT\r\n", unmatched="Couldn't find expected output 'SOME TeXT")
|
# expect_prompt(TO_END + "SOME TeXT\r\n", unmatched="Couldn't find expected output 'SOME TeXT")
|
||||||
|
|
||||||
|
send("echo echo")
|
||||||
|
send("\033")
|
||||||
|
sleep(0.200)
|
||||||
|
send("bgU\r")
|
||||||
|
expect_prompt("echo ECHO")
|
||||||
|
|
||||||
send("echo 125")
|
send("echo 125")
|
||||||
send("\033")
|
send("\033")
|
||||||
sleep(0.200)
|
sleep(0.200)
|
||||||
|
|
Loading…
Reference in a new issue