mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-06 10:12:38 +02:00
commit bash-20200117 snapshot
This commit is contained in:
+19
-8
@@ -1,6 +1,6 @@
|
||||
/* bind.c -- key binding and startup file support for the readline library. */
|
||||
|
||||
/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -166,10 +166,12 @@ rl_bind_key (int key, rl_command_func_t *function)
|
||||
|
||||
/* If it's bound to a function or macro, just overwrite. Otherwise we have
|
||||
to treat it as a key sequence so rl_generic_bind handles shadow keymaps
|
||||
for us. If we are binding '\' make sure to escape it so it makes it
|
||||
through the call to rl_translate_keyseq. */
|
||||
for us. If we are binding '\' or \C-@ (NUL) make sure to escape it so
|
||||
it makes it through the call to rl_translate_keyseq. */
|
||||
if (_rl_keymap[key].type != ISKMAP)
|
||||
{
|
||||
if (_rl_keymap[key].type == ISMACR)
|
||||
xfree ((char *)_rl_keymap[key].function);
|
||||
_rl_keymap[key].type = ISFUNC;
|
||||
_rl_keymap[key].function = function;
|
||||
}
|
||||
@@ -178,8 +180,17 @@ rl_bind_key (int key, rl_command_func_t *function)
|
||||
l = 0;
|
||||
bind_keyseq:
|
||||
if (key == '\\')
|
||||
keyseq[l++] = '\\';
|
||||
keyseq[l++] = key;
|
||||
{
|
||||
keyseq[l++] = '\\';
|
||||
keyseq[l++] = '\\';
|
||||
}
|
||||
else if (key == '\0')
|
||||
{
|
||||
keyseq[l++] = '\\';
|
||||
keyseq[l++] = '0';
|
||||
}
|
||||
else
|
||||
keyseq[l++] = key;
|
||||
keyseq[l] = '\0';
|
||||
rl_bind_keyseq (keyseq, function);
|
||||
}
|
||||
@@ -451,9 +462,7 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (map[ic].type == ISMACR)
|
||||
xfree ((char *)map[ic].function);
|
||||
else if (map[ic].type == ISKMAP)
|
||||
if (map[ic].type == ISKMAP)
|
||||
{
|
||||
prevmap = map;
|
||||
map = FUNCTION_TO_KEYMAP (map, ic);
|
||||
@@ -466,6 +475,8 @@ rl_generic_bind (int type, const char *keyseq, char *data, Keymap map)
|
||||
if (type == ISFUNC && data == 0)
|
||||
data = (char *)_rl_null_function;
|
||||
}
|
||||
if (map[ic].type == ISMACR)
|
||||
xfree ((char *)map[ic].function);
|
||||
|
||||
map[ic].function = KEYMAP_TO_FUNCTION (data);
|
||||
map[ic].type = type;
|
||||
|
||||
@@ -223,7 +223,7 @@ static int msg_bufsiz = 0;
|
||||
static int forced_display;
|
||||
|
||||
/* Default and initial buffer size. Can grow. */
|
||||
static int line_size = DEFAULT_LINE_BUFFER_SIZE;
|
||||
static int line_size = DEFAULT_LINE_BUFFER_SIZE;
|
||||
|
||||
/* Set to a non-zero value if horizontal scrolling has been enabled
|
||||
automatically because the terminal was resized to height 1. */
|
||||
@@ -1678,6 +1678,8 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
|
||||
consume the first character of old. Fix up `old' so it
|
||||
reflects the new screen contents. We use +1 in the
|
||||
memmove call to copy the trailing NUL. */
|
||||
/* (strlen(old+oldbytes) == (omax - oldbytes - 1)) */
|
||||
|
||||
memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1);
|
||||
memcpy (old, new, newbytes);
|
||||
j = newbytes - oldbytes;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* funmap.c -- attach names to functions. */
|
||||
|
||||
/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/* posixdir.h -- Posix directory reading includes and defines. */
|
||||
|
||||
/* Copyright (C) 1987,1991,2012 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
Bash is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Bash is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* This file should be included instead of <dirent.h> or <sys/dir.h>. */
|
||||
|
||||
#if !defined (_POSIXDIR_H_)
|
||||
#define _POSIXDIR_H_
|
||||
|
||||
#if defined (HAVE_DIRENT_H)
|
||||
# include <dirent.h>
|
||||
# if defined (HAVE_STRUCT_DIRENT_D_NAMLEN)
|
||||
# define D_NAMLEN(d) ((d)->d_namlen)
|
||||
# else
|
||||
# define D_NAMLEN(d) (strlen ((d)->d_name))
|
||||
# endif /* !HAVE_STRUCT_DIRENT_D_NAMLEN */
|
||||
#else
|
||||
# if defined (HAVE_SYS_NDIR_H)
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# if defined (HAVE_SYS_DIR_H)
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# if defined (HAVE_NDIR_H)
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
# if !defined (dirent)
|
||||
# define dirent direct
|
||||
# endif /* !dirent */
|
||||
# define D_NAMLEN(d) ((d)->d_namlen)
|
||||
#endif /* !HAVE_DIRENT_H */
|
||||
|
||||
/* The bash code fairly consistently uses d_fileno; make sure it's available */
|
||||
#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (HAVE_STRUCT_DIRENT_D_FILENO)
|
||||
# define d_fileno d_ino
|
||||
#endif
|
||||
|
||||
/* Posix does not require that the d_ino field be present, and some
|
||||
systems do not provide it. */
|
||||
#if !defined (HAVE_STRUCT_DIRENT_D_INO) || defined (BROKEN_DIRENT_D_INO)
|
||||
# define REAL_DIR_ENTRY(dp) 1
|
||||
#else
|
||||
# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
|
||||
#endif /* _POSIX_SOURCE */
|
||||
|
||||
#if defined (HAVE_STRUCT_DIRENT_D_INO) && !defined (BROKEN_DIRENT_D_INO)
|
||||
# define D_INO_AVAILABLE
|
||||
#endif
|
||||
|
||||
/* Signal the rest of the code that it can safely use dirent.d_fileno */
|
||||
#if defined (D_INO_AVAILABLE) || defined (HAVE_STRUCT_DIRENT_D_FILENO)
|
||||
# define D_FILENO_AVAILABLE 1
|
||||
#endif
|
||||
|
||||
#endif /* !_POSIXDIR_H_ */
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../include/posixdir.h
|
||||
+14
-2
@@ -1,7 +1,7 @@
|
||||
/* readline.c -- a general facility for reading lines of input
|
||||
with emacs style editing and completion. */
|
||||
|
||||
/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -870,6 +870,8 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
if (rl_key_sequence_length > 0)
|
||||
rl_executing_keyseq[--rl_key_sequence_length] = '\0';
|
||||
return -2;
|
||||
}
|
||||
else if (got_subseq)
|
||||
@@ -882,6 +884,8 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
if (rl_key_sequence_length > 0)
|
||||
rl_executing_keyseq[--rl_key_sequence_length] = '\0';
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -974,7 +978,11 @@ _rl_dispatch_subseq (register int key, Keymap map, int got_subseq)
|
||||
_rl_pushed_input_available () == 0 &&
|
||||
_rl_dispatching_keymap[ANYOTHERKEY].function &&
|
||||
_rl_input_queued (_rl_keyseq_timeout*1000) == 0)
|
||||
return (_rl_subseq_result (-2, map, key, got_subseq));
|
||||
{
|
||||
if (rl_key_sequence_length > 0)
|
||||
rl_executing_keyseq[--rl_key_sequence_length] = '\0';
|
||||
return (_rl_subseq_result (-2, map, key, got_subseq));
|
||||
}
|
||||
|
||||
newkey = _rl_subseq_getchar (key);
|
||||
if (newkey < 0)
|
||||
@@ -1065,6 +1073,8 @@ _rl_subseq_result (int r, Keymap map, int key, int got_subseq)
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
if (rl_key_sequence_length > 0)
|
||||
rl_executing_keyseq[--rl_key_sequence_length] = '\0';
|
||||
_rl_dispatching_keymap = map;
|
||||
return -2;
|
||||
}
|
||||
@@ -1075,6 +1085,8 @@ _rl_subseq_result (int r, Keymap map, int key, int got_subseq)
|
||||
_rl_prev_macro_key ();
|
||||
else
|
||||
_rl_unget_char (key);
|
||||
if (rl_key_sequence_length > 0)
|
||||
rl_executing_keyseq[--rl_key_sequence_length] = '\0';
|
||||
_rl_dispatching_keymap = map;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -479,6 +479,8 @@ rl_forward_word (int count, int key)
|
||||
|
||||
while (count)
|
||||
{
|
||||
if (rl_point > rl_end)
|
||||
rl_point = rl_end;
|
||||
if (rl_point == rl_end)
|
||||
return 0;
|
||||
|
||||
@@ -498,6 +500,8 @@ rl_forward_word (int count, int key)
|
||||
}
|
||||
}
|
||||
|
||||
if (rl_point > rl_end)
|
||||
rl_point = rl_end;
|
||||
if (rl_point == rl_end)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -1162,6 +1162,7 @@ rl_domove_motion_callback (_rl_vimotion_cxt *m)
|
||||
/* Append a blank character temporarily so that the motion routines
|
||||
work right at the end of the line. Original value of rl_end is saved
|
||||
as m->end. */
|
||||
rl_extend_line_buffer (rl_end + 1);
|
||||
rl_line_buffer[rl_end++] = ' ';
|
||||
rl_line_buffer[rl_end] = '\0';
|
||||
|
||||
@@ -1193,8 +1194,7 @@ _rl_vi_domove_motion_cleanup (int c, _rl_vimotion_cxt *m)
|
||||
/* Remove the blank that we added in rl_domove_motion_callback. */
|
||||
rl_end = m->end;
|
||||
rl_line_buffer[rl_end] = '\0';
|
||||
if (rl_point > rl_end)
|
||||
rl_point = rl_end;
|
||||
_rl_fix_point (0);
|
||||
|
||||
/* No change in position means the command failed. */
|
||||
if (rl_mark == rl_point)
|
||||
@@ -1518,6 +1518,8 @@ vi_yank_dispatch (_rl_vimotion_cxt *m)
|
||||
rl_do_undo ();
|
||||
rl_point = m->start;
|
||||
|
||||
_rl_fix_point (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user