aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2010-11-22 19:29:59 +0000
committerTom Feist <shabble@metavore.org>2010-11-22 19:29:59 +0000
commit43addba4cdcb540b21a743274cbf6317f6bcdad8 (patch)
treeceeb7125b2748221bcfcf42582814d17428704c5
parentvim_mode: fix :snext/prev generating warnings when not connected (diff)
downloadirssi-scripts-43addba4cdcb540b21a743274cbf6317f6bcdad8.tar.gz
irssi-scripts-43addba4cdcb540b21a743274cbf6317f6bcdad8.zip
vim_mode: mapped Irssi commands only use $server context if it is available.
TODO: should maybe also try to use window context if available?
-rw-r--r--vim-mode/vim_mode.pl10
1 files changed, 9 insertions, 1 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 94d8967..bad556e 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -2532,7 +2532,15 @@ sub handle_command_cmd {
# As can irssi commands.
} elsif ($cmd->{type} == C_IRSSI) {
print "Processing irssi-command: $map->{char} ($cmd->{char})" if DEBUG;
- Irssi::active_server->command($cmd->{func});
+
+ # TODO: fix me more better (general server/win/none context?)
+ my $server = Irssi::active_server;
+ if (defined $server) {
+ $server->command($cmd->{func});
+ } else {
+ Irssi::command($cmd->{func});
+ }
+
$numeric_prefix = undef;
return 1; # call _stop();
# <Nop> does nothing.