aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-01-01 17:59:40 +0000
committerTom Feist <shabble@metavore.org>2011-01-01 17:59:40 +0000
commit7dc9343579432c99312a9a132877d94e27f279da (patch)
tree4878a7f613ace5bd6c4f31035ce602968f3bba5c
parentkey_test: dumped some key-processing code in there I plan to look at later. (diff)
downloadirssi-scripts-7dc9343579432c99312a9a132877d94e27f279da.tar.gz
irssi-scripts-7dc9343579432c99312a9a132877d94e27f279da.zip
ido-mode/ido_switcher: added help binding (C-h) since there were getting to be a lot
of features. TODO: get it displaying better - centered, maybe?
-rw-r--r--ido-mode/ido_switcher.pl48
1 files changed, 47 insertions, 1 deletions
diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl
index 5d6be5a..5576b32 100644
--- a/ido-mode/ido_switcher.pl
+++ b/ido-mode/ido_switcher.pl
@@ -46,7 +46,7 @@
# at the bottom of the current window.
# * All other keys (a-z, A-Z, etc) - Add that character to the current search
# string.
-#
+#
# USAGE NOTES:
#
# * Using C-e (show actives), followed by repeatedly pressing space will cycle
@@ -124,6 +124,7 @@ my $active_only = 0;
my $mode_type = 'ALL';
my @mode_cache;
+my $showing_help = 0;
my $need_clear = 0;
@@ -167,6 +168,39 @@ sub _print_clear {
$win->command('/scrollback levelclear -level NEVER');
}
+sub display_help {
+
+ my @message =
+ ('%_IDO Window Switching Help:%_',
+ '',
+ '%_Ctrl-g%_ - cancel out of the mode without changing windows.',
+ '%_Esc%_ - cancel out, as above.',
+ '%_Ctrl-s%_ - rotate the list of window candidates forward by 1',
+ '%_Ctrl-r%_ - rotate the list of window candidates backward by 1',
+ '%_Ctrl-e%_ - Toggle \'Active windows only\' filter',
+ '%_Ctrl-f%_ - Switch between \'Flex\' and \'Exact\' matching.',
+ '%_Ctrl-d%_ - Select a network or server to filter candidates by',
+ '%_Ctrl-u%_ - Clear the current search string',
+ '%_Ctrl-q%_ - Cycle between showing only queries, channels, or all.',
+ '%_Ctrl-SPC%_ - Filter candidates by current search string, and then ',
+ ' reset the search string',
+ '%_RET%_ - Select the current head of the candidate list (the %_green%n one)',
+ '%_SPC%_ - Select the current head of the list, without exiting switching',
+ ' mode. The head is then moved one place to the right,',
+ ' allowing one to cycle through channels by repeatedly pressing space.',
+ '%_TAB%_ - [%_currently non-functional%_] displays all possible completions',
+ ' at the bottom of the current window.',
+ '',
+ ' %_All other keys (a-z, A-Z, etc) - Add that character to the',
+ ' %_current search string.',
+ '',
+ '%_Press Any Key to return%_',
+ );
+
+ _print($_) for @message;
+ $showing_help = 1;
+}
+
sub print_all_matches {
my $msg = join(", ", map { $_->{name} } @search_matches);
my $message_header = "Windows:";
@@ -622,6 +656,12 @@ sub get_all_windows {
return unless $ido_switch_active;
+ if ($showing_help) {
+ _print_clear();
+ $showing_help = 0;
+ Irssi::signal_stop();
+ }
+
if ($key == 0) { # C-SPC?
_debug_print "\%_Ctrl-space\%_";
@@ -720,6 +760,12 @@ sub get_all_windows {
return;
}
+ if ($key == 8) { # Ctrl-h
+ display_help();
+ Irssi::signal_stop();
+ return;
+ }
+
if ($key == 21) { # Ctrl-u
$search_str = '';
update_matches();