From 8bdc72c608d4c9940d2af11294e5eccdbfc9a225 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 27 Sep 2010 18:58:11 +0200 Subject: vim_mode: Always reset command mode status when entering command mode. --- vim-mode/vim_mode.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index f63c5a8..5d96893 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -814,13 +814,6 @@ sub handle_input_buffer { print "Enter Command Mode" if DEBUG; _update_mode(M_CMD); - # Reset every command mode related setting as a fallback in case - # something goes wrong. - $numeric_prefix = undef; - $operator = undef; - $movement = undef; - $register = '"'; - } else { # we need to identify what we got, and either replay it # or pass it off to the command handler. @@ -1167,7 +1160,15 @@ sub _update_mode { if ($mode == M_INS) { $history_index = undef; $register = '"'; + # Reset every command mode related status as a fallback in case something + # goes wrong. + } elsif ($mode == M_CMD) { + $numeric_prefix = undef; + $operator = undef; + $movement = undef; + $register = '"'; } + Irssi::statusbar_items_redraw("vim_mode"); } -- cgit v1.2.3 From 24d45912c23d1d26c18f5aa97b4b5700bc210d32 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 27 Sep 2010 21:20:31 +0200 Subject: vim_mode: Don't fail if prompt_info.pl isn't available. Only ex mode is disabled in this case. --- vim-mode/vim_mode.pl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 5d96893..26f22e5 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -151,12 +151,7 @@ sub script_is_loaded { return $retval; } -unless (script_is_loaded('prompt_info')) { - die "This script requires 'prompt_info' in order to work. " - . "Please load it and try again"; -} else { - vim_mode_init(); -} +vim_mode_init(); # vi-operators like d, c; they don't move the cursor @@ -1015,8 +1010,13 @@ sub handle_command { # Start Ex mode. } elsif ($char eq ':') { - _update_mode(M_EX); - _set_prompt(':'); + if (not script_is_loaded('prompt_info')) { + print "This script requires the 'prompt_info' script to " + . "support Ex mode. Please load it and try again."; + } else { + _update_mode(M_EX); + _set_prompt(':'); + } # Enter key sends the current input line in command mode as well. } elsif ($key == 10) { -- cgit v1.2.3 From 4a1d46e1a48dfc60defb924d971486d18fd41c10 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 27 Sep 2010 21:25:24 +0200 Subject: vim_mode: Add missing DEBUGs in prints. --- vim-mode/vim_mode.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl index 26f22e5..ef411e2 100644 --- a/vim-mode/vim_mode.pl +++ b/vim-mode/vim_mode.pl @@ -233,11 +233,11 @@ sub cmd_undo { print "Undo!" if DEBUG; if ($undo_index > $#undo_buffer) { $undo_index = $#undo_buffer; - print "No further undo."; + print "No further undo." if DEBUG; } elsif ($undo_index != $#undo_buffer) { $undo_index++; } - print "Undoing entry $undo_index of " . $#undo_buffer; + print "Undoing entry $undo_index of " . $#undo_buffer if DEBUG; _restore_undo_entry($undo_index); } @@ -1070,7 +1070,7 @@ sub UNLOAD { sub _add_undo_entry { my ($line, $pos) = @_; # add to the front of the buffer - print "adding $line to undo list"; + print "adding $line to undo list" if DEBUG; unshift @undo_buffer, [$line, $pos]; $undo_index = 0; } -- cgit v1.2.3