Fixes behavior of 'x' in normal mode

After 'x' is used to delete a character at the end of a line the cursor
should be repositioned at the last character, i.e. repeatedly pressing
'x' in normal mode should delete the entire string.
This commit is contained in:
Michael Steinert 2016-11-30 14:28:43 -06:00 committed by Kurtis Rader
parent 1fbcb1ee9d
commit e2ed561264
3 changed files with 16 additions and 0 deletions

View file

@ -2746,6 +2746,9 @@ const wchar_t *reader_readline(int nchars) {
if (el->position < el->size()) {
update_buff_pos(el, el->position + 1);
remove_backward();
if (el->position > 0 && el->position == el->size()) {
update_buff_pos(el, el->position - 1);
}
}
break;
}

View file

@ -92,6 +92,18 @@ expect_prompt -re {\r\nTAXT\r\n} {
puts stderr "vi mode replace char, default timeout: long delay"
}
# Test deleting characters with 'x'.
send "echo MORE-TEXT"
send "\033"
# Delay needed to allow fish to transition to vi "normal" mode.
sleep 0.150
send "xxxxx\r"
expect_prompt -re {\r\nMORE\r\n} {
puts "vi mode delete char, default timeout: long delay"
} unmatched {
puts stderr "vi mode delete char, default timeout: long delay"
}
# Verify that changing the escape timeout has an effect.
send "set -g fish_escape_delay_ms 200\r"
expect_prompt

View file

@ -5,6 +5,7 @@ prime vi mode, default timeout
vi-mode default timeout set correctly
vi replace line, default timeout: long delay
vi mode replace char, default timeout: long delay
vi mode delete char, default timeout: long delay
vi replace line, 100ms timeout: long delay
vi replace line, 100ms timeout: short delay
t-binding success