diff --git a/src/reader.rs b/src/reader.rs index 77671a132..2c8b79ce0 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -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); diff --git a/tests/pexpects/bind.py b/tests/pexpects/bind.py index 9d9e57707..67bac5286 100644 --- a/tests/pexpects/bind.py +++ b/tests/pexpects/bind.py @@ -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")