Subject: | CTRL-R gives warnings when next keys are pressed. |
Run the tiny example from perldoc Term::Readline but run it with perl's
-w option. Then, when you hit CTRL-R (for F_ReverseSearchHistory), then
you'll get these warnings for every pressed key after CTRL-R (C-r in
emacs terminology):
Use of uninitialized value within @readline::KeyMap in string eq at
(eval 8) line 21.
Use of uninitialized value within @readline::KeyMap in string eq at
(eval 8) line 21.
This is fixed with the attached patch.
Subject: | ctrl-r-warning.patch |
--- orig.readline.pm 2009-05-19 12:57:15.000000000 +0200
+++ readline.pm 2009-05-19 12:56:40.000000000 +0200
@@ -2904,7 +2904,7 @@
&redisplay( '('.($reverse?'reverse-':'') ."i-search) `$searchstr': ");
$c = &getc_with_pending;
- if ($KeyMap[ord($c)] eq 'F_ReverseSearchHistory') {
+ if ($KeyMap[ord($c)] && $KeyMap[ord($c)] eq 'F_ReverseSearchHistory') {
if ($reverse && $I != -1) {
if ($tmp = &search($I-1,$searchstr), $tmp >= 0) {
$I = $tmp;
@@ -2913,7 +2913,7 @@
}
}
$reverse = 1;
- } elsif ($KeyMap[ord($c)] eq 'F_ForwardSearchHistory') {
+ } elsif ($KeyMap[ord($c)] && $KeyMap[ord($c)] eq 'F_ForwardSearchHistory') {
if (!$reverse && $I != -1) {
if ($tmp = &search($I+1,$searchstr), $tmp >= 0) {
$I = $tmp;