commit bash-20191127 snapshot

This commit is contained in:
Chet Ramey
2019-12-02 17:23:48 -05:00
parent fc35c477cd
commit 091c6bc481
34 changed files with 5916 additions and 5603 deletions
+82 -12
View File
@@ -1,6 +1,6 @@
/* display.c -- readline redisplay facility. */
/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
/* Copyright (C) 1987-2019 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.
@@ -192,6 +192,8 @@ int _rl_last_v_pos = 0;
on screen minus 1. */
int _rl_vis_botlin = 0;
static int _rl_quick_redisplay = 0;
/* This is a hint update_line gives to rl_redisplay that it has adjusted the
value of _rl_last_c_pos *and* taken the presence of any invisible chars in
the prompt into account. rl_redisplay notes this and does not do the
@@ -223,6 +225,10 @@ static int forced_display;
/* Default and initial buffer size. Can grow. */
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. */
static int horizontal_scrolling_autoset = 0; /* explicit initialization */
/* Variables to keep track of the expanded prompt string, which may
include invisible characters. */
@@ -653,7 +659,21 @@ init_line_structures (int minsize)
line_structures_initialized = 1;
}
/* Do whatever tests are necessary and tell update_line that it can do a
quick, dumb redisplay on the assumption that there are so many
differences between the old and new lines that it would be a waste to
compute all the differences.
Right now, it just sets _rl_quick_redisplay if the current visible line
is a single line (so we don't have to move vertically or mess with line
wrapping). */
void
_rl_optimize_redisplay (void)
{
if (_rl_vis_botlin == 0)
_rl_quick_redisplay = 1;
}
/* Basic redisplay algorithm. See comments inline. */
void
rl_redisplay (void)
@@ -690,7 +710,18 @@ rl_redisplay (void)
}
else if (line_size <= _rl_screenwidth)
init_line_structures (_rl_screenwidth + 1);
/* Enable horizontal scrolling automatically for terminals of height 1
where wrapping lines doesn't work. Disable it as soon as the terminal
height is increased again if it was automatically enabled. */
if (_rl_screenheight <= 1)
{
if (_rl_horizontal_scroll_mode == 0)
horizontal_scrolling_autoset = 1;
_rl_horizontal_scroll_mode = 1;
}
else if (horizontal_scrolling_autoset)
_rl_horizontal_scroll_mode = 0;
/* Draw the line into the buffer. */
cpos_buffer_position = -1;
@@ -1210,19 +1241,35 @@ rl_redisplay (void)
_rl_clear_to_eol (nleft);
}
#if 0
/* This segment is intended to handle the case where the prompt
has invisible characters on the second line and the new line
/* This segment is intended to handle the case where the old
visible prompt has invisible characters and the new line
to be displayed needs to clear the rest of the old characters
out (e.g., when printing the i-search prompt). In general,
the case of the new line being shorter than the old.
Incomplete */
else if (linenum == prompt_last_screen_line &&
prompt_physical_chars > _rl_screenwidth &&
wrap_offset != prompt_invis_chars_first_line &&
out (e.g., when printing the i-search prompt): in general,
the case of the new line being shorter than the old. We need
to be at the end of the new line and the old line needs to be
longer than the current cursor position. It's not perfect,
since it uses the byte length of the first line, but this will
at worst result in some extra clear-to-end-of-lines. We can't
use the prompt length variables because they may not
correspond to the visible line (see printing the i-search
prompt above). The tests for differing numbers of invisible
characters may not matter and can probably be removed. */
else if (linenum == 0 &&
linenum == prompt_last_screen_line &&
_rl_last_c_pos == out &&
_rl_last_c_pos < visible_first_line_len &&
visible_wrap_offset &&
visible_wrap_offset != wrap_offset)
{
if (mb_cur_max > 1 && rl_byte_oriented == 0)
nleft = _rl_screenwidth - _rl_last_c_pos;
else
nleft = _rl_screenwidth + wrap_offset - _rl_last_c_pos;
if (nleft)
_rl_clear_to_eol (nleft);
}
#endif
/* Since the new first line is now visible, save its length. */
if (linenum == 0)
visible_first_line_len = (inv_botlin > 0) ? inv_lbreaks[1] : out - wrap_offset;
@@ -1445,6 +1492,8 @@ rl_redisplay (void)
visible_wrap_offset = 0;
else
visible_wrap_offset = wrap_offset;
_rl_quick_redisplay = 0;
}
RL_UNSETSTATE (RL_STATE_REDISPLAYING);
@@ -1657,6 +1706,19 @@ update_line (char *old, char *new, int current_line, int omax, int nmax, int inv
}
}
if (_rl_quick_redisplay)
{
nfd = new;
ofd = old;
for (od = 0, oe = ofd; od < omax && *oe; oe++, od++);
for (nd = 0, ne = nfd; nd < nmax && *ne; ne++, nd++);
od = nd = 0;
_rl_move_cursor_relative (0, old);
cpos_adjusted = 1;
goto dumb_update;
}
/* Find first difference. */
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
@@ -1963,6 +2025,14 @@ dumb_update:
else
col_lendiff = lendiff;
/* col_lendiff uses _rl_col_width(), which doesn't know about whether or not
the multibyte characters it counts are invisible, so the count is short by
the number of bytes in the invisible multibyte characters - the number of
multibyte characters. We don't have a good way to solve this without
moving to something like a bitmap that indicates which characters are
visible and which are invisible. We fix it up (imperfectly) in the
caller. */
/* If we are changing the number of invisible characters in a line, and
the spot of first difference is before the end of the invisible chars,
lendiff needs to be adjusted. */
+3 -2
View File
@@ -6,9 +6,9 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Thu Dec 28 14:49:51 EST 2017
.\" Last Change: Mon Nov 25 10:53:27 EST 2019
.\"
.TH READLINE 3 "2017 December 28" "GNU Readline 8.0"
.TH READLINE 3 "2019 November 25" "GNU Readline 8.0"
.\"
.\" File Name macro. This used to be `.PN', for Path Name,
.\" but Sun doesn't seem to like that very much.
@@ -488,6 +488,7 @@ the maximum number of history entries will be set to 500.
When set to \fBOn\fP, makes readline use a single line for display,
scrolling the input horizontally on a single screen line when it
becomes longer than the screen width rather than wrapping to a new line.
This setting is automatically enabled for terminals of height 1.
.TP
.B input\-meta (Off)
If set to \fBOn\fP, readline will enable eight-bit input (that is,
+3 -2
View File
@@ -588,8 +588,9 @@ the maximum number of history entries will be set to 500.
This variable can be set to either @samp{on} or @samp{off}. Setting it
to @samp{on} means that the text of the lines being edited will scroll
horizontally on a single screen line when they are longer than the width
of the screen, instead of wrapping onto a new screen line. By default,
this variable is set to @samp{off}.
of the screen, instead of wrapping onto a new screen line.
This variable is automatically set to @samp{on} for terminals of height 1.
By default, this variable is set to @samp{off}.
@item input-meta
@vindex input-meta
+2 -2
View File
@@ -4,7 +4,7 @@ Copyright (C) 1988-2019 Free Software Foundation, Inc.
@set EDITION 8.0
@set VERSION 8.0
@set UPDATED 15 November 2019
@set UPDATED 25 November 2019
@set UPDATED-MONTH November 2019
@set LASTCHANGE Fri Nov 15 09:34:19 EST 2019
@set LASTCHANGE Mon Nov 25 10:53:13 EST 2019
+3 -1
View File
@@ -185,11 +185,13 @@ rl_display_search (char *search_string, int flags, int where)
strcpy (message + msglen, "i-search)`");
msglen += 10;
if (search_string)
if (search_string && *search_string)
{
strcpy (message + msglen, search_string);
msglen += searchlen;
}
else
_rl_optimize_redisplay ();
strcpy (message + msglen, "': ");
+1
View File
@@ -276,6 +276,7 @@ extern void _rl_erase_at_end_of_line PARAMS((int));
extern void _rl_clear_to_eol PARAMS((int));
extern void _rl_clear_screen PARAMS((void));
extern void _rl_update_final PARAMS((void));
extern void _rl_optimize_redisplay PARAMS((void));
extern void _rl_redisplay_after_sigwinch PARAMS((void));
extern void _rl_clean_up_for_exit PARAMS((void));
extern void _rl_erase_entire_line PARAMS((void));