aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Ruderich <simon@ruderich.org>2010-09-26 15:56:37 +0000
committerSimon Ruderich <simon@ruderich.org>2010-09-26 15:56:37 +0000
commit96a90035ca507ec3da116e8f887ff4967b6cd9ec (patch)
tree69b9146554c5afa1875a4d8a35a6fee6bc8fd288
parentvim_mode: Add ~. (diff)
downloadirssi-scripts-96a90035ca507ec3da116e8f887ff4967b6cd9ec.tar.gz
irssi-scripts-96a90035ca507ec3da116e8f887ff4967b6cd9ec.zip
vim_mode: Fix p at the end of the line.
Diffstat (limited to '')
-rw-r--r--vim-mode/vim_mode.pl8
1 files changed, 7 insertions, 1 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index e372050..39752fc 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -430,7 +430,13 @@ sub _paste_at_position {
my $string = $registers->{'"'} x $count;
my $input = _input();
- substr($input, $pos, 0) = $string;
+ # Check if we are not at the end of the line to prevent substr outside of
+ # string error.
+ if (length $input > $pos) {
+ substr($input, $pos, 0) = $string;
+ } else {
+ $input .= $string;
+ }
_input($input);
_input_pos($pos - 1 + length $string);