more documentation updates; fix two issues when displaying readline completions; fix another use-after-free error with readline undo lists

This commit is contained in:
Chet Ramey
2024-12-13 09:51:46 -05:00
parent 5b239ebbd2
commit bb56d620e0
31 changed files with 38385 additions and 2136 deletions
+7 -3
View File
@@ -881,7 +881,8 @@ fnprint (const char *to_print, int prefix_bytes, const char *real_pathname)
possible completions. Only cut off prefix_bytes if we're going to be
printing the ellipsis, which takes precedence over coloring the
completion prefix (see print_filename() below). */
if (_rl_completion_prefix_display_length > 0 && prefix_bytes >= print_len)
if (_rl_completion_prefix_display_length > 0 && prefix_bytes >= print_len &&
prefix_bytes > _rl_completion_prefix_display_length)
prefix_bytes = 0;
#if defined (COLOR_SUPPORT)
@@ -900,13 +901,16 @@ fnprint (const char *to_print, int prefix_bytes, const char *real_pathname)
printed_len = ELLIPSIS_LEN;
}
#if defined (COLOR_SUPPORT)
else if (prefix_bytes && _rl_colored_completion_prefix > 0)
else if (prefix_bytes && _rl_completion_prefix_display_length <= 0 &&
_rl_colored_completion_prefix > 0)
{
common_prefix_len = prefix_bytes;
prefix_bytes = 0;
/* XXX - print color indicator start here */
colored_prefix_start ();
}
else
common_prefix_len = prefix_bytes = 0; /* no ellipsis or color */
#endif
s = to_print + prefix_bytes;
@@ -1602,7 +1606,7 @@ rl_display_match_list (char **matches, int len, int max)
/* check again in case of /usr/src/ */
temp = rl_filename_completion_desired ? strrchr (t, '/') : 0;
common_length = temp ? fnwidth (temp) : fnwidth (t);
sind = temp ? strlen (temp) : strlen (t);
sind = temp ? RL_STRLEN (temp) : RL_STRLEN (t);
if (common_length > max || sind > max)
common_length = sind = 0;
+3
View File
@@ -533,6 +533,9 @@ completions that is displayed without modification.
When set to a value greater than zero, \fBreadline\fP
replaces common prefixes longer than this value
with an ellipsis when displaying possible completions.
If a completion begins with a period,
and \fBeadline\fP is completing filenames,
it uses three underscores instead of an ellipsis.
.TP
.B completion\-query\-items (100)
This determines when the user is queried about viewing
+3
View File
@@ -556,6 +556,9 @@ completions that is displayed without modification.
When set to a value greater than zero, Readline
replaces common prefixes longer than this value
with an ellipsis when displaying possible completions.
If a completion begins with a period,
and Readline is completing filenames,
it uses three underscores instead of an ellipsis.
@item completion-query-items
@vindex completion-query-items
+1 -1
View File
@@ -218,7 +218,7 @@ _rl_isearch_init (int direction)
/* Create an array of pointers to the lines that we want to search. */
hlist = history_list ();
rl_maybe_replace_line ();
_rl_maybe_replace_line (1);
i = 0;
if (hlist)
for (i = 0; hlist[i]; i++);