mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 12:40:42 +02:00
commit bash-20200504 snapshot
This commit is contained in:
@@ -149,7 +149,14 @@ Both @var{first} and
|
||||
@var{last} may be specified as a string (to locate the most recent
|
||||
command beginning with that string) or as a number (an index into the
|
||||
history list, where a negative number is used as an offset from the
|
||||
current command number). If @var{last} is not specified, it is set to
|
||||
current command number).
|
||||
|
||||
When listing, a @var{first} or @var{last} of 0 is equivalent to -1
|
||||
and -0 is equivalent to the current command (usually the @code{fc}
|
||||
command);
|
||||
otherwise 0 is equivalent to -1 and -0 is invalid.
|
||||
|
||||
If @var{last} is not specified, it is set to
|
||||
@var{first}. If @var{first} is not specified, it is set to the previous
|
||||
command for editing and @minus{}16 for listing. If the @option{-l} flag is
|
||||
given, the commands are listed on standard output. The @option{-n} flag
|
||||
|
||||
@@ -918,6 +918,15 @@ 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
|
||||
|
||||
@@ -1322,6 +1322,14 @@ the direction through the history (back or forward).
|
||||
The history expansion facilities are used to extract the last argument,
|
||||
as if the @samp{!$} history expansion had been specified.
|
||||
|
||||
@item 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.
|
||||
|
||||
@end ftable
|
||||
|
||||
@node Commands For Text
|
||||
@@ -1794,12 +1802,6 @@ Perform history and alias expansion on the current line.
|
||||
@item insert-last-argument (M-. or M-_)
|
||||
A synonym for @code{yank-last-arg}.
|
||||
|
||||
@item operate-and-get-next (C-o)
|
||||
Accept the current line for execution 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.
|
||||
|
||||
@item edit-and-execute-command (C-x C-e)
|
||||
Invoke an editor on the current command line, and execute the result as shell
|
||||
commands.
|
||||
|
||||
@@ -4,7 +4,7 @@ Copyright (C) 1988-2020 Free Software Foundation, Inc.
|
||||
|
||||
@set EDITION 8.0
|
||||
@set VERSION 8.0
|
||||
@set UPDATED 24 March 2020
|
||||
@set UPDATED-MONTH March 2020
|
||||
@set UPDATED 4 May 2020
|
||||
@set UPDATED-MONTH May 2020
|
||||
|
||||
@set LASTCHANGE Tue Mar 24 09:28:28 EDT 2020
|
||||
@set LASTCHANGE Mon May 4 14:55:02 EDT 2020
|
||||
|
||||
@@ -47,7 +47,7 @@ KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
|
||||
{ ISFUNC, rl_clear_screen }, /* Control-l */
|
||||
{ ISFUNC, rl_newline }, /* Control-m */
|
||||
{ ISFUNC, rl_get_next_history }, /* Control-n */
|
||||
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-o */
|
||||
{ ISFUNC, rl_operate_and_get_next }, /* Control-o */
|
||||
{ ISFUNC, rl_get_previous_history }, /* Control-p */
|
||||
{ ISFUNC, rl_quoted_insert }, /* Control-q */
|
||||
{ ISFUNC, rl_reverse_search_history }, /* Control-r */
|
||||
|
||||
@@ -117,6 +117,7 @@ static const FUNMAP default_funmap[] = {
|
||||
{ "non-incremental-forward-search-history-again", rl_noninc_forward_search_again },
|
||||
{ "non-incremental-reverse-search-history-again", rl_noninc_reverse_search_again },
|
||||
{ "old-menu-complete", rl_old_menu_complete },
|
||||
{ "operate-and-get-next", rl_operate_and_get_next },
|
||||
{ "overwrite-mode", rl_overwrite_mode },
|
||||
#if defined (_WIN32)
|
||||
{ "paste-from-clipboard", rl_paste_from_clipboard },
|
||||
|
||||
@@ -637,6 +637,48 @@ rl_get_previous_history (int count, int key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The equivalent of the Korn shell C-o operate-and-get-next-history-line
|
||||
editing command. */
|
||||
|
||||
/* This could stand to be global to the readline library */
|
||||
static rl_hook_func_t *_rl_saved_internal_startup_hook = 0;
|
||||
static int saved_history_logical_offset = -1;
|
||||
|
||||
#define HISTORY_FULL() (history_is_stifled () && history_length >= history_max_entries)
|
||||
|
||||
static int
|
||||
set_saved_history ()
|
||||
{
|
||||
int absolute_offset, count;
|
||||
|
||||
if (saved_history_logical_offset >= 0)
|
||||
{
|
||||
absolute_offset = saved_history_logical_offset - history_base;
|
||||
count = where_history () - absolute_offset;
|
||||
rl_get_previous_history (count, 0);
|
||||
}
|
||||
saved_history_logical_offset = -1;
|
||||
_rl_internal_startup_hook = _rl_saved_internal_startup_hook;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
rl_operate_and_get_next (count, c)
|
||||
int count, c;
|
||||
{
|
||||
/* Accept the current line. */
|
||||
rl_newline (1, c);
|
||||
|
||||
saved_history_logical_offset = rl_explicit_arg ? count : where_history () + history_base + 1;
|
||||
|
||||
|
||||
_rl_saved_internal_startup_hook = _rl_internal_startup_hook;
|
||||
_rl_internal_startup_hook = set_saved_history;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Editing Modes */
|
||||
|
||||
@@ -199,6 +199,10 @@ int rl_key_sequence_length = 0;
|
||||
before readline_internal_setup () prints the first prompt. */
|
||||
rl_hook_func_t *rl_startup_hook = (rl_hook_func_t *)NULL;
|
||||
|
||||
/* Any readline function can set this and have it run just before the user's
|
||||
rl_startup_hook. */
|
||||
rl_hook_func_t *_rl_internal_startup_hook = (rl_hook_func_t *)NULL;
|
||||
|
||||
/* If non-zero, this is the address of a function to call just before
|
||||
readline_internal_setup () returns and readline_internal starts
|
||||
reading input characters. */
|
||||
@@ -420,6 +424,9 @@ readline_internal_setup (void)
|
||||
if (rl_startup_hook)
|
||||
(*rl_startup_hook) ();
|
||||
|
||||
if (_rl_internal_startup_hook)
|
||||
(*_rl_internal_startup_hook) ();
|
||||
|
||||
rl_deactivate_mark ();
|
||||
|
||||
#if defined (VI_MODE)
|
||||
|
||||
@@ -133,6 +133,7 @@ extern int rl_beginning_of_history PARAMS((int, int));
|
||||
extern int rl_end_of_history PARAMS((int, int));
|
||||
extern int rl_get_next_history PARAMS((int, int));
|
||||
extern int rl_get_previous_history PARAMS((int, int));
|
||||
extern int rl_operate_and_get_next PARAMS((int, int));
|
||||
|
||||
/* Bindable commands for managing the mark and region. */
|
||||
extern int rl_set_mark PARAMS((int, int));
|
||||
|
||||
@@ -545,6 +545,8 @@ extern int _rl_keyseq_timeout;
|
||||
|
||||
extern int _rl_executing_keyseq_size;
|
||||
|
||||
extern rl_hook_func_t *_rl_internal_startup_hook;
|
||||
|
||||
/* search.c */
|
||||
extern _rl_search_cxt *_rl_nscxt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user