From 69a0ace326eb7050539980c6cbca340cdae9b741 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 29 Sep 2010 17:00:52 +0200 Subject: vim_mode: Only allow access to registers a-z and " * +. --- vim-mode/vim_mode.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'vim-mode') 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'); -- cgit v1.2.3