Don't move cursor in delete-char

Instead, move forward and backward in vi-mode.

Fixes #3899.
This commit is contained in:
Fabian Homborg 2017-04-19 22:59:53 +02:00 committed by David Adam
parent a26419557f
commit f5fac096c0
2 changed files with 6 additions and 6 deletions

View file

@ -118,10 +118,13 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
bind -M insert -k end end-of-line 2>/dev/null bind -M insert -k end end-of-line 2>/dev/null
bind -M default -k end end-of-line 2>/dev/null bind -M default -k end end-of-line 2>/dev/null
bind -M default x delete-char # Vi moves the cursor back if, after deleting, it is at EOL.
# To emulate that, move forward, then backward, which will be a NOP
# if there is something to move forward to.
bind -M default x delete-char forward-char backward-char
bind -M default X backward-delete-char bind -M default X backward-delete-char
bind -M insert -k dc delete-char bind -M insert -k dc delete-char forward-char backward-char
bind -M default -k dc delete-char bind -M default -k dc delete-char forward-char backward-char
# Backspace deletes a char in insert mode, but not in normal/default mode. # Backspace deletes a char in insert mode, but not in normal/default mode.
bind -M insert -k backspace backward-delete-char bind -M insert -k backspace backward-delete-char

View file

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