diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-09-29 01:47:08 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-09-29 13:59:15 +0000 |
commit | 5cbd1e07ee5a7d75019512150d34db98788056e7 (patch) | |
tree | bfae6b55e8a98cfe9c2e763f0410080ddc21ff8d | |
parent | additional debug prints in _input(_pos) to determine why undo positions are (diff) | |
download | irssi-scripts-5cbd1e07ee5a7d75019512150d34db98788056e7.tar.gz irssi-scripts-5cbd1e07ee5a7d75019512150d34db98788056e7.zip |
vim_mode: Fix cursor position to work like Vim.
Diffstat (limited to '')
-rw-r--r-- | vim-mode/vim_mode.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 8dfa35d..786921c 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -1370,6 +1370,17 @@ sub _stop() { sub _update_mode { my ($new_mode) = @_; + + # In insert mode we are "between" characters, in command mode "on top" of + # keys. When leaving insert mode we have to move on key left to accomplish + # that. + if ($mode == M_INS and $new_mode == M_CMD) { + my $pos = _input_pos(); + if ($pos != 0) { + _input_pos($pos - 1); + } + } + $mode = $new_mode; if ($mode == M_INS) { $history_index = undef; |