diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-10-02 23:57:10 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-10-02 23:57:10 +0000 |
commit | 0fc08ac1f4ce48d1b9529968428fb40550f9c87c (patch) | |
tree | c63298cbbac5ec7c02323860dbdebeeac58dbbbc /vim-mode/vim_mode.pl | |
parent | vim_mode: Fix indentation. (diff) | |
download | irssi-scripts-0fc08ac1f4ce48d1b9529968428fb40550f9c87c.tar.gz irssi-scripts-0fc08ac1f4ce48d1b9529968428fb40550f9c87c.zip |
vim_mode: Fix caw.
In contrast to cw, caw does delete the space before a word.
Diffstat (limited to '')
-rw-r--r-- | vim-mode/vim_mode.pl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 9d78677..8a6a2ab 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -462,6 +462,11 @@ sub _get_pos_and_length { $length *= -1; } + # Strip leading a_ or i_ if a text-object was used. + if ($move =~ /^[ai]_(.)/) { + $move = $1; + } + # Most movement commands don't move one character after the deletion area # (which is what we need). For those increase length to support proper # selection/deletion. @@ -1713,11 +1718,11 @@ sub handle_command_cmd { # problems with e.g. f when the search string doesn't exist). if ($operator and $cur_pos != $new_pos) { print "Processing operator: ", $operator if DEBUG; - # If text-objects are used the real move character must be - # passed to the operator. + # If text-objects are used the real move character must also + # be passed to the operator. my $tmp_char = $char; if ($char eq 'i_' or $char eq 'a_') { - $tmp_char = substr $movement, 1; + $tmp_char .= substr $movement, 1; } $operators->{$operator}->{func}->($cur_pos, $new_pos, $tmp_char, $repeat); |