aboutsummaryrefslogtreecommitdiffstats
path: root/vim-mode
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2010-10-26 21:41:12 +0000
committerTom Feist <shabble@metavore.org>2010-10-26 21:41:12 +0000
commit39042d55764fd5d13c9bab0557ed541935e48357 (patch)
tree35f50b9d234e0f04ce063cf1550caaeeac709b21 /vim-mode
parentimplement :servernext/prev and :itemnext/prev for switching between servers and (diff)
downloadirssi-scripts-39042d55764fd5d13c9bab0557ed541935e48357.tar.gz
irssi-scripts-39042d55764fd5d13c9bab0557ed541935e48357.zip
replace server id separator with \x1d to avoid unintended matches
make :map'ed irssi commands use hte current server context $server->cmd(..)
Diffstat (limited to 'vim-mode')
-rw-r--r--vim-mode/vim_mode.pl15
1 files changed, 8 insertions, 7 deletions
diff --git a/vim-mode/vim_mode.pl b/vim-mode/vim_mode.pl
index 71b30b1..a18d6db 100644
--- a/vim-mode/vim_mode.pl
+++ b/vim-mode/vim_mode.pl
@@ -1718,12 +1718,13 @@ sub ex_item_prev {
$win->item_prev for (1..$count);
}
+# TODO: factor out the shared search code for server next/prev.
sub ex_server_next {
my ($arg_str, $count) = @_;
- my @server_ids = map { $_->{tag} . '/' . $_->{nick} } Irssi::servers;
+ my @server_ids = map { $_->{tag} . "\x1d" . $_->{nick} } Irssi::servers;
my $server = Irssi::active_server;
- my $current_id = $server->{tag} . '/' . $server->{nick};
+ my $current_id = $server->{tag} . "\x1d" . $server->{nick};
my $next = 0;
my $server_count = scalar @server_ids;
for my $i (0..$server_count - 1) {
@@ -1736,7 +1737,7 @@ sub ex_server_next {
}
my $next_server = $server_ids[$next];
- $next_server =~ s|^([^/]+)/.*$|$1|;
+ $next_server =~ s|^([^\x1d]+)\x1d.*$|$1|;
print "Changing to server: $next: $next_server" if DEBUG;
Irssi::command("window server $next_server");
@@ -1745,9 +1746,9 @@ sub ex_server_next {
sub ex_server_prev {
my ($arg_str, $count) = @_;
- my @server_ids = map { $_->{tag} . '/' . $_->{nick} } Irssi::servers;
+ my @server_ids = map { $_->{tag} . "\x1d" . $_->{nick} } Irssi::servers;
my $server = Irssi::active_server;
- my $current_id = $server->{tag} . '/' . $server->{nick};
+ my $current_id = $server->{tag} . "\x1d" . $server->{nick};
my $prev = 0;
my $server_count = scalar @server_ids;
@@ -1761,7 +1762,7 @@ sub ex_server_prev {
}
my $prev_server = $server_ids[$prev];
- $prev_server =~ s|^([^/]+)/.*$|$1|;
+ $prev_server =~ s|^([^\x1d]+)\x1d.*$|$1|;
print "Changing to server: $prev: $prev_server" if DEBUG;
Irssi::command("window server $prev_server");
@@ -2451,7 +2452,7 @@ sub handle_command_cmd {
# As can irssi commands.
} elsif ($cmd->{type} == C_IRSSI) {
print "Processing irssi-command: $map->{char} ($cmd->{char})" if DEBUG;
- Irssi::command($cmd->{func});
+ Irssi::active_server->command($cmd->{func});
$numeric_prefix = undef;
return 1; # call _stop();