]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
commit readline-20210708 snapshot
authorChet Ramey <chet.ramey@case.edu>
Thu, 8 Jul 2021 19:56:54 +0000 (15:56 -0400)
committerChet Ramey <chet.ramey@case.edu>
Thu, 8 Jul 2021 19:56:54 +0000 (15:56 -0400)
16 files changed:
bind.c
display.c
doc/readline.3
doc/rltech.texi
doc/rluser.texi
doc/version.texi
funmap.c
misc.c
readline.c
readline.h
rlprivate.h
search.c
signals.c
support/shobj-conf
terminal.c
vi_mode.c

diff --git a/bind.c b/bind.c
index e47fe2d7600d3e9ec6d7aae1152376052abbfb36..f1456d61e7b563d430e1acc1136069cb141d9132 100644 (file)
--- a/bind.c
+++ b/bind.c
@@ -880,6 +880,84 @@ rl_function_of_keyseq_len (const char *keyseq, size_t len, Keymap map, int *type
   return _rl_function_of_keyseq_internal (keyseq, len, map, type);
 }
 
+/* Assuming there is a numeric argument at the beginning of KEYSEQ (the
+   caller is responsible for checking), return the index of the portion of
+   the key sequence following the numeric argument. If there's no numeric
+   argument (?), or if KEYSEQ consists solely of a numeric argument (?),
+   return -1. */
+int
+rl_trim_arg_from_keyseq        (const char *keyseq, size_t len, Keymap map)
+{
+  register int i, j, parsing_digits;
+  unsigned char ic;
+  Keymap map0;
+
+  if (map == 0)
+    map = _rl_keymap;
+  map0 = map;
+
+  /* The digits following the initial one (e.g., the binding to digit-argument)
+    or the optional `-' in a binding to digit-argument or universal-argument
+    are not added to rl_executing_keyseq. This is basically everything read by
+    rl_digit_loop. The parsing_digits logic is here in case they ever are. */
+  for (i = j = parsing_digits = 0; keyseq && i < len; i++)
+    {
+      ic = keyseq[i];
+
+      if (parsing_digits)
+       {
+         if (_rl_digit_p (ic))
+           {
+             j = i + 1;
+             continue;
+           }
+         parsing_digits = 0;
+       }
+
+      if (map[ic].type == ISKMAP)
+       {
+         if (i + 1 == len)
+           return -1;
+         map = FUNCTION_TO_KEYMAP (map, ic);
+         continue;
+       }
+      if (map[ic].type == ISFUNC)
+       {
+#if defined (VI_MODE)
+         if (map[ic].function != rl_digit_argument && map[ic].function != rl_universal_argument && map[ic].function != rl_vi_arg_digit)
+#else
+         if (map[ic].function != rl_digit_argument && map[ic].function != rl_universal_argument)
+#endif
+           return (j);
+
+         /* We don't bother with a keyseq that is only a numeric argument */
+         if (i + 1 == len)
+           return -1;
+
+         map = map0;
+         parsing_digits = 1;
+
+         /* This logic should be identical to rl_digit_loop */
+         /* We accept M-- as equivalent to M--1, C-u- as equivalent to C-u-1
+            but set parsing_digits to 2 to note that we saw `-' */
+         if (map[ic].function == rl_universal_argument && (i + 1 == '-'))
+           {
+             i++;
+             parsing_digits = 2;
+           }
+         if (map[ic].function == rl_digit_argument && ic == '-')
+           {
+             parsing_digits = 2;
+           }
+         j = i + 1;
+       }
+    }
+
+  /* If we're still parsing digits by the time we get here, we don't allow a
+     key sequence that consists solely of a numeric argument */
+  return -1;
+}
+  
 /* The last key bindings file read. */
 static char *last_readline_init_file = (char *)NULL;
 
@@ -1154,6 +1232,12 @@ const char * const _rl_possible_meta_prefixes[] = {
   "Meta", "M-", (const char *)NULL
 };
 
+/* Forward declarations */
+static int parser_if (char *);
+static int parser_else (char *);
+static int parser_endif (char *);
+static int parser_include (char *);
+
 /* Conditionals. */
 
 /* Calling programs set this to have their argv[0]. */
@@ -1813,6 +1897,7 @@ static const struct {
   { "convert-meta",            &_rl_convert_meta_chars_to_ascii, 0 },
   { "disable-completion",      &rl_inhibit_completion,         0 },
   { "echo-control-characters", &_rl_echo_control_chars,        0 },
+  { "enable-active-region",    &_rl_enable_active_region,      0 },
   { "enable-bracketed-paste",  &_rl_enable_bracketed_paste,    V_SPECIAL },
   { "enable-keypad",           &_rl_enable_keypad,             0 },
   { "enable-meta-key",         &_rl_enable_meta,               0 },
index de2dc7257b7d27d28e5d0f612d90a8aef2dbe937..62a39b8862035d96980216df69eda17f2c8c65e0 100644 (file)
--- a/display.c
+++ b/display.c
@@ -1598,7 +1598,7 @@ puts_face (const char *str, const char *face, int n)
   char cur_face;
 
   for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
-    putc_face (str[i], face[i], &cur_face);
+    putc_face ((unsigned char) str[i], face[i], &cur_face);
   putc_face (EOF, FACE_NORMAL, &cur_face);
 }
 
@@ -2421,9 +2421,24 @@ dumb_update:
                ((nfd-new) < (prompt_last_invisible-(current_line*_rl_screenwidth+prompt_invis_chars_first_line))))
            ADJUST_CPOS (wrap_offset - prompt_invis_chars_first_line);
 
-         /* XXX - what happens if wrap_offset == prompt_invis_chars_first_line
-            and we are drawing the first line (current_line == 0)? We should
-            adjust by _rl_last_c_pos -= prompt_invis_chars_first_line */
+         /* What happens if wrap_offset == prompt_invis_chars_first_line
+            and we are drawing the first line (current_line == 0), or if we
+            are drawing the first line and changing the number of invisible
+            characters in the line? If we're starting to draw before the last
+            invisible character in the prompt, we need to adjust by
+            _rl_last_c_pos -= prompt_invis_chars_first_line. This can happen
+            when we finish reading a digit argument (with the "(arg: N)"
+            prompt) and are switching back to displaying a line with a prompt
+            containing invisible characters, since we have to redraw the
+            entire prompt string. */
+         if ((mb_cur_max > 1 && rl_byte_oriented == 0) &&
+               current_line == 0 && wrap_offset &&
+               displaying_prompt_first_line &&
+               wrap_offset == prompt_invis_chars_first_line &&
+               visible_wrap_offset != current_invis_chars &&
+               visible_wrap_offset != prompt_invis_chars_first_line &&
+               ((nfd-new) < prompt_last_invisible))
+           ADJUST_CPOS (prompt_invis_chars_first_line);
        }
     }
   else                         /* Delete characters from line. */
index 179c7814bcd384110e37df8e072a6841e08693f2..cf59b43ea27c66469431be2031536e05dfbb1352 100644 (file)
@@ -6,9 +6,9 @@
 .\"    Case Western Reserve University
 .\"    chet.ramey@case.edu
 .\"
-.\"    Last Change: Tue Mar 24 09:27:30 EDT 2020
+.\"    Last Change: Wed Jun 16 09:49:37 EDT 2021
 .\"
-.TH READLINE 3 "2020 October 29" "GNU Readline 8.1"
+.TH READLINE 3 "2021 June 16" "GNU Readline 8.1"
 .\"
 .\" File Name macro.  This used to be `.PN', for Path Name,
 .\" but Sun doesn't seem to like that very much.
@@ -408,7 +408,8 @@ If the number of possible completions is greater than
 or equal to the value of this variable,
 readline will ask whether or not the user wishes to view them;
 otherwise they are simply listed
-on the terminal.  A negative value causes readline to never ask.
+on the terminal.
+A negative value causes readline to never ask.
 .TP
 .B convert\-meta (On)
 If set to \fBOn\fP, readline will convert characters with the
@@ -447,6 +448,17 @@ Use the \e1 and \e2 escapes to begin and end sequences of
 non-printing characters, which can be used to embed a terminal control 
 sequence into the mode string.
 .TP
+.B enable\-active\-region (On)
+The \fIpoint\fP is the current cursor position, and \fImark\fP refers
+to a saved cursor position.
+The text between the point and mark is referred to as the \fIregion\fP.
+When this variable is set to \fIOn\fP, readline allows certain commands
+to designate the region as \fIactive\fP.
+When the region is active, readline highlights the text in the region using
+the terminal's standout mode.
+The active region shows the text inserted by bracketed-paste and any
+matching text found by incremental and non-incremental history searches.
+.TP
 .B enable\-bracketed\-paste (On)
 When set to \fBOn\fP, readline will configure the terminal in a way
 that will enable it to insert each paste into the editing buffer as a
@@ -853,6 +865,21 @@ Move to the first line in the history.
 Move to the end of the input history, i.e., the line currently being
 entered.
 .TP
+.B
+operate\-and\-get\-next (C\-o)
+Accept the current line for return to the calling application as if a
+newline had been entered,
+and fetch the next line relative to the current line from the history
+for editing.
+A numeric argument, if supplied, specifies the history entry to use instead
+of the current line.
+.TP
+.B
+fetch\-history
+With a numeric argument, fetch that entry from the history list
+and make it the current line.
+Without an argument, move back to the first entry in the history list.
+.TP
 .B reverse\-search\-history (C\-r)
 Search backward starting at the current line and moving `up' through
 the history as necessary.  This is an incremental search.
@@ -919,15 +946,6 @@ the direction to move through the history.  A negative argument switches
 the direction through the history (back or forward).
 The history expansion facilities are used to extract the last argument,
 as if the "!$" history expansion had been specified.
-.TP
-.B
-operate\-and\-get\-next (C\-o)
-Accept the current line for return to the calling application as if a
-newline had been entered,
-and fetch the next line relative to the current line from the history
-for editing.
-A numeric argument, if supplied, specifies the history entry to use instead
-of the current line.
 .PD
 .SS Commands for Changing Text
 .PD 0
index a440225668d961f9c4d6961c7ee998e1575f68b6..8c4814ecfaf2bee4ff06cc9bd35972fbf69e938b 100644 (file)
@@ -885,6 +885,15 @@ It takes a "translated" key sequence and should be used if the key sequence
 can include NUL.
 @end deftypefun
 
+@deftypefun {int} rl_trim_arg_from_keyseq (const char *keyseq, size_t len, Keymap map)
+If there is a numeric argument at the beginning of @var{keyseq}, possibly
+including digits, return the index of the first character in @var{keyseq}
+following the numeric argument.
+This can be used to skip over the numeric argument (which is available as
+@code{rl_numeric_arg} while traversing the key sequence that invoked the
+current command.
+@end deftypefun
+
 @deftypefun {char **} rl_invoking_keyseqs (rl_command_func_t *function)
 Return an array of strings representing the key sequences used to
 invoke @var{function} in the current keymap.
@@ -1072,8 +1081,9 @@ It returns the number of visible characters on the last line of the
 Applications may indicate that the prompt contains characters that take
 up no physical screen space when displayed by bracketing a sequence of
 such characters with the special markers @code{RL_PROMPT_START_IGNORE}
-and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h}).  This may
-be used to embed terminal-specific escape sequences in prompts.
+and @code{RL_PROMPT_END_IGNORE} (declared in @file{readline.h} as
+@samp{\001} and @samp{\002}, respectively).
+This may be used to embed terminal-specific escape sequences in prompts.
 @end deftypefun
 
 @deftypefun int rl_set_prompt (const char *prompt)
@@ -1641,7 +1651,7 @@ main (int c, char **v)
 
 Signals are asynchronous events sent to a process by the Unix kernel,
 sometimes on behalf of another process.  They are intended to indicate
-exceptional events, like a user pressing the interrupt key on his terminal,
+exceptional events, like a user pressing the terminal's interrupt key,
 or a network connection being broken.  There is a class of signals that can
 be sent to the process currently reading input from the keyboard.  Since
 Readline changes the terminal attributes when it is called, it needs to
@@ -2189,9 +2199,10 @@ shell variables and hostnames.
 
 @deftypevar int rl_completion_query_items
 Up to this many items will be displayed in response to a
-possible-completions call.  After that, readline asks the user if she is sure
-she wants to see them all.  The default value is 100.  A negative value 
-indicates that Readline should never ask the user.
+possible-completions call.  After that, readline asks the user for
+confirmation before displaying them.
+The default value is 100.  A negative value 
+indicates that Readline should never ask for confirmation.
 @end deftypevar
 
 @deftypevar {int} rl_completion_append_character
index 26b0ff072c7a8503f3e9e567ca4cfecdd3dcc506..6990e85058c703922bfbb25d18666011dd56b42b 100644 (file)
@@ -339,7 +339,8 @@ Although the Readline library comes with a set of Emacs-like
 keybindings installed by default, it is possible to use a different set
 of keybindings.
 Any user can customize programs that use Readline by putting
-commands in an @dfn{inputrc} file, conventionally in his home directory.
+commands in an @dfn{inputrc} file,
+conventionally in their home directory.
 The name of this
 @ifset BashFeatures
 file is taken from the value of the shell variable @env{INPUTRC}.  If
@@ -496,8 +497,9 @@ asked whether the list of possibilities should be displayed.
 If the number of possible completions is greater than or equal to this value,
 Readline will ask whether or not the user wishes to view them;
 otherwise, they are simply listed.
-This variable must be set to an integer value greater than or equal to 0.
-A negative value means Readline should never ask.
+This variable must be set to an integer value greater than or equal to zero.
+A zero value means Readline should never ask; negative values are
+treated as zero.
 The default limit is @code{100}.
 
 @item convert-meta
@@ -540,6 +542,19 @@ non-printing characters, which can be used to embed a terminal control
 sequence into the mode string.
 The default is @samp{@@}.
 
+@item enable-active-region
+@vindex enable-active-region
+The @dfn{point} is the current cursor position, and @dfn{mark} refers
+to a saved cursor position (@pxref{Commands For Moving}).
+The text between the point and mark is referred to as the @dfn{region}.
+When this variable is set to @samp{On}, Readline allows certain commands
+to designate the region as @dfn{active}.
+When the region is active, Readline highlights the text in the region using
+the terminal's standout mode.
+The active region shows the text inserted by bracketed-paste and any
+matching text found by incremental and non-incremental history searches.
+The default is @samp{On}.
+
 @item enable-bracketed-paste
 @vindex enable-bracketed-paste
 When set to @samp{On}, Readline will configure the terminal in a way
@@ -1332,6 +1347,11 @@ for editing.
 A numeric argument, if supplied, specifies the history entry to use instead
 of the current line.
 
+@item fetch-history ()
+With a numeric argument, fetch that entry from the history list
+and make it the current line.
+Without an argument, move back to the first entry in the history list.
+
 @end ftable
 
 @node Commands For Text
@@ -1772,6 +1792,11 @@ the output is formatted in such a way that it can be made part
 of an @var{inputrc} file.  This command is unbound by default.
 
 @ifset BashFeatures
+@item spell-correct-word (C-x s)
+Perform spelling correction on the current word, treating it as a directory
+or filename, in the same way as the @code{cdspell} shell option.
+Word boundaries are the same as those used by @code{shell-forward-word}.
+
 @item glob-complete-word (M-g)
 The word before point is treated as a pattern for pathname expansion,
 with an asterisk implicitly appended.  This pattern is used to
index a935f8353f21ae51e1dec62552094a7c0bef32ad..d422668aff6b0445debc0d268a96613d42040e33 100644 (file)
@@ -4,7 +4,7 @@ Copyright (C) 1988-2021 Free Software Foundation, Inc.
 
 @set EDITION 8.1
 @set VERSION 8.1
-@set UPDATED 10 March 2021
-@set UPDATED-MONTH March 2021
+@set UPDATED 16 June 2021
+@set UPDATED-MONTH June 2021
 
-@set LASTCHANGE Wed Mar 10 15:43:49 EST 2021
+@set LASTCHANGE Wed Jun 16 09:50:11 EDT 2021
index 09ee1d7a2f489bb2398cce5a4b64aaf8728409d5..8b1cb4028db7fb0afe1e677d08d2a0ee12cac007 100644 (file)
--- a/funmap.c
+++ b/funmap.c
@@ -93,6 +93,7 @@ static const FUNMAP default_funmap[] = {
   { "end-of-history", rl_end_of_history },
   { "end-of-line", rl_end_of_line },
   { "exchange-point-and-mark", rl_exchange_point_and_mark },
+  { "fetch-history", rl_fetch_history },
   { "forward-backward-delete-char", rl_rubout_or_delete },
   { "forward-byte", rl_forward_byte },
   { "forward-char", rl_forward_char },
@@ -198,6 +199,7 @@ static const FUNMAP default_funmap[] = {
   { "vi-set-mark", rl_vi_set_mark },
   { "vi-subst", rl_vi_subst },
   { "vi-tilde-expand", rl_vi_tilde_expand },
+  { "vi-undo", rl_vi_undo },
   { "vi-unix-word-rubout", rl_vi_unix_word_rubout },
   { "vi-yank-arg", rl_vi_yank_arg },
   { "vi-yank-pop", rl_vi_yank_pop },
diff --git a/misc.c b/misc.c
index 44e39008ec5418d61ec020826c2fee665b820de6..23f2ad5e428dd2e22f5dacb38846ccb25d94ae07 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -634,6 +634,42 @@ rl_get_previous_history (int count, int key)
   return 0;
 }
 
+/* With an argument, move back that many history lines, else move to the
+   beginning of history. */
+int
+rl_fetch_history (int count, int c)
+{
+  int wanted, nhist;
+
+  /* Giving an argument of n means we want the nth command in the history
+     file.  The command number is interpreted the same way that the bash
+     `history' command does it -- that is, giving an argument count of 450
+     to this command would get the command listed as number 450 in the
+     output of `history'. */
+  if (rl_explicit_arg)
+    {
+      nhist = history_base + where_history ();
+      /* Negative arguments count back from the end of the history list. */
+      wanted = (count >= 0) ? nhist - count : -count;
+
+      if (wanted <= 0 || wanted >= nhist)
+       {
+         /* In vi mode, we don't change the line with an out-of-range
+            argument, as for the `G' command. */
+         if (rl_editing_mode == vi_mode)
+           rl_ding ();
+         else
+           rl_beginning_of_history (0, 0);
+       }
+      else
+        rl_get_previous_history (wanted, c);
+    }
+  else
+    rl_beginning_of_history (count, 0);
+
+  return (0);
+}
+
 /* The equivalent of the Korn shell C-o operate-and-get-next-history-line
    editing command. */
 
index 4002fe511de779e1b379de5ec8ece54177f05c78..a048d58bff8c662a4069d4e9142e5bf3fc43e60d 100644 (file)
@@ -1549,3 +1549,12 @@ _rl_add_executing_keyseq (int key)
   RESIZE_KEYSEQ_BUFFER ();
  rl_executing_keyseq[rl_key_sequence_length++] = key;
 }
+
+/* `delete' the last character added to the executing key sequence. Use this
+   before calling rl_execute_next to avoid keys being added twice. */
+void
+_rl_del_executing_keyseq (void)
+{
+  if (rl_key_sequence_length > 0)
+    rl_key_sequence_length--;
+}
index ab33823d96443c27bcebd0bd4d77be2501870768..124f57b1d94dc8d847049c24e45c920fa5f3a311 100644 (file)
@@ -134,6 +134,7 @@ extern int rl_end_of_history (int, int);
 extern int rl_get_next_history (int, int);
 extern int rl_get_previous_history (int, int);
 extern int rl_operate_and_get_next (int, int);
+extern int rl_fetch_history (int, int);
 
 /* Bindable commands for managing the mark and region. */
 extern int rl_set_mark (int, int);
@@ -335,6 +336,7 @@ extern char *rl_untranslate_keyseq (int);
 extern rl_command_func_t *rl_named_function (const char *);
 extern rl_command_func_t *rl_function_of_keyseq (const char *, Keymap, int *);
 extern rl_command_func_t *rl_function_of_keyseq_len (const char *, size_t, Keymap, int *);
+extern int rl_trim_arg_from_keyseq (const char *, size_t, Keymap);
 
 extern void rl_list_funmap_names (void);
 extern char **rl_invoking_keyseqs_in_map (rl_command_func_t *, Keymap);
index 86a29127a5149849fa6f708e09316e4922fcd243..bda34119ef1086ee8c5343b19b718ff84b47364e 100644 (file)
@@ -379,6 +379,7 @@ extern void _rl_init_executing_keyseq (void);
 extern void _rl_term_executing_keyseq (void);
 extern void _rl_end_executing_keyseq (void);
 extern void _rl_add_executing_keyseq (int);
+extern void _rl_del_executing_keyseq (void);
 
 /* rltty.c */
 extern int _rl_disable_tty_signals (void);
index 0d503e830c89d07f11f12ca220900c0d354caf97..6cfe97d50291e693905b8a44f9b609b62e4f5503 100644 (file)
--- a/search.c
+++ b/search.c
@@ -259,11 +259,11 @@ static void
 _rl_nsearch_abort (_rl_search_cxt *cxt)
 {
   rl_maybe_unsave_line ();
-  rl_clear_message ();
   rl_point = cxt->save_point;
   rl_mark = cxt->save_mark;
-  _rl_fix_point (1);
   rl_restore_prompt ();
+  rl_clear_message ();
+  _rl_fix_point (1);
 
   RL_UNSETSTATE (RL_STATE_NSEARCH);
 }
index 2bbec3ec14c57133459d2150b2ec94cea6dc7497..83cdc53f81b18fb38e31f2ebe8344d4c67ed5366 100644 (file)
--- a/signals.c
+++ b/signals.c
@@ -64,7 +64,7 @@
 
 /* This typedef is equivalent to the one for Function; it allows us
    to say SigHandler *foo = signal (SIGKILL, SIG_IGN); */
-typedef RETSIGTYPE SigHandler ();
+typedef RETSIGTYPE SigHandler (int);
 
 #if defined (HAVE_POSIX_SIGNALS)
 typedef struct sigaction sighandler_cxt;
index 729d847b23f460a1ba1aee61d4cd1922866d40a9..acbb344ebbeb7eeb4d3d4512a00fec6252007cba 100644 (file)
@@ -241,8 +241,8 @@ osf*)
 
 aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*)            # lightly tested by jik@cisco.com
        SHOBJ_CFLAGS=-fpic
-       SHOBJ_LD='ld'
-       SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
+       SHOBJ_LD='${CC}'
+       SHOBJ_LDFLAGS='-Wl,-bdynamic -Wl,-bnoentry -Wl,-bexpall'
        SHOBJ_XLDFLAGS='-G'
 
        SHLIB_XLDFLAGS='-bM:SRE'
index cf2e8b15fe4bf72abe5e0b95614ab891f8065807..8bdc9a4edcf4502a2761cabc2b40dffbb75be7f5 100644 (file)
@@ -177,6 +177,10 @@ static char *_rl_term_kD;
 /* Insert key */
 static char *_rl_term_kI;
 
+/* Page up and page down keys */
+static char *_rl_term_kP;
+static char *_rl_term_kN;
+
 /* Cursor control */
 static char *_rl_term_vs;      /* very visible */
 static char *_rl_term_ve;      /* normal */
@@ -415,6 +419,8 @@ static const struct _tc_string tc_strings[] =
   { "kD", &_rl_term_kD },      /* delete */
   { "kH", &_rl_term_kH },      /* home down ?? */
   { "kI", &_rl_term_kI },      /* insert */
+  { "kN", &_rl_term_kN },      /* page down */
+  { "kN", &_rl_term_kP },      /* page up */
   { "kd", &_rl_term_kd },
   { "ke", &_rl_term_ke },      /* end keypad mode */
   { "kh", &_rl_term_kh },      /* home */
@@ -478,6 +484,7 @@ _rl_init_terminal_io (const char *terminal_name)
   _rl_term_goto = _rl_term_pc = _rl_term_ip = (char *)NULL;
   _rl_term_ks = _rl_term_ke =_rl_term_vs = _rl_term_ve = (char *)NULL;
   _rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;
+  _rl_term_kN = _rl_term_kP = (char *)NULL;
   _rl_term_so = _rl_term_se = (char *)NULL;
 #if defined(HACK_TERMCAP_MOTION)
   _rl_term_forward_char = (char *)NULL;
@@ -540,6 +547,7 @@ _rl_init_terminal_io (const char *terminal_name)
       _rl_term_ku = _rl_term_kd = _rl_term_kl = _rl_term_kr = (char *)NULL;
       _rl_term_kh = _rl_term_kH = _rl_term_kI = _rl_term_kD = (char *)NULL;
       _rl_term_ks = _rl_term_ke = _rl_term_at7 = (char *)NULL;
+      _rl_term_kN = _rl_term_kP = (char *)NULL;
       _rl_term_mm = _rl_term_mo = (char *)NULL;
       _rl_term_ve = _rl_term_vs = (char *)NULL;
       _rl_term_forward_char = (char *)NULL;
@@ -629,6 +637,9 @@ bind_termcap_arrow_keys (Keymap map)
   rl_bind_keyseq_if_unbound (_rl_term_kD, rl_delete);
   rl_bind_keyseq_if_unbound (_rl_term_kI, rl_overwrite_mode);  /* Insert */
 
+  rl_bind_keyseq_if_unbound (_rl_term_kN, rl_history_search_forward);  /* Page Down */
+  rl_bind_keyseq_if_unbound (_rl_term_kP, rl_history_search_backward); /* Page Up */
+
   _rl_keymap = xkeymap;
 }
 
index da7350d289cb0624a4207c2a9e4c540e5e3852bd..6f14820e595454320dba9810c47801ebe44b0f18 100644 (file)
--- a/vi_mode.c
+++ b/vi_mode.c
@@ -337,24 +337,7 @@ rl_vi_yank_arg (int count, int key)
 int
 rl_vi_fetch_history (int count, int c)
 {
-  int wanted;
-
-  /* Giving an argument of n means we want the nth command in the history
-     file.  The command number is interpreted the same way that the bash
-     `history' command does it -- that is, giving an argument count of 450
-     to this command would get the command listed as number 450 in the
-     output of `history'. */
-  if (rl_explicit_arg)
-    {
-      wanted = history_base + where_history () - count;
-      if (wanted <= 0)
-        rl_beginning_of_history (0, 0);
-      else
-        rl_get_previous_history (wanted, c);
-    }
-  else
-    rl_beginning_of_history (count, 0);
-  return (0);
+  return (rl_fetch_history (count, c));
 }
 
 /* Search again for the last thing searched for. */