diff options
author | Simon Ruderich <simon@ruderich.org> | 2010-09-29 15:00:52 +0000 |
---|---|---|
committer | Simon Ruderich <simon@ruderich.org> | 2010-09-29 15:00:52 +0000 |
commit | 69a0ace326eb7050539980c6cbca340cdae9b741 (patch) | |
tree | b8b02c841116f4bc381bb6ddf034ca3f56b57d1e | |
parent | vim_mode: Make sure ex commands match from the beginning. (diff) | |
download | irssi-scripts-69a0ace326eb7050539980c6cbca340cdae9b741.tar.gz irssi-scripts-69a0ace326eb7050539980c6cbca340cdae9b741.zip |
vim_mode: Only allow access to registers a-z and " * +.
-rw-r--r-- | vim-mode/vim_mode.pl | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index c4719d7..63d51ca 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -180,11 +180,16 @@ my $mode = M_INS; # current active register my $register = '"'; -# vi registers, " is the default register +# vi registers my $registers = { - '"' => '' + '"' => '', # default register + '+' => '', # contains irssi's cut buffer + '*' => '', # same }; +foreach my $char ('a' .. 'z') { + $registers->{$char} = ''; +} # current imap still pending (first character entered) my $imap = undef; @@ -744,6 +749,11 @@ sub cmd_movement_tilde { sub cmd_movement_register { my ($count, $pos, $repeat, $char) = @_; + if (not exists $registers->{$char}) { + print "Wrong register $char, ignoring." if DEBUG; + return; + } + # + and * contain both irssi's cut-buffer if ($char eq '+' or $char eq '*') { $registers->{'+'} = Irssi::parse_special('$U'); |