mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-07 18:52:35 +02:00
clarify some arithmetic error messages; fix for read builtin readline timeouts; initial implementation of preserving double quotes in readline completion; add starting line number to some "EOF reached" parser error messages
This commit is contained in:
@@ -1784,6 +1784,11 @@ make_quoted_replacement (char *match, int mtype, char *qc)
|
||||
should_quote = rl_filename_quote_characters
|
||||
? (_rl_strpbrk (match, rl_filename_quote_characters) != 0)
|
||||
: 0;
|
||||
/* If we saw a quote in the original word, but readline thinks the
|
||||
match doesn't need to be quoted, and the application has a filename
|
||||
quoting function, give the application a chance to quote it if
|
||||
needed so we don't second-guess the user. */
|
||||
should_quote |= *qc == 0 && rl_completion_found_quote && mtype != NO_MATCH && rl_filename_quoting_function;
|
||||
|
||||
do_replace = should_quote ? mtype : NO_MATCH;
|
||||
/* Quote the replacement, since we found an embedded
|
||||
@@ -1791,6 +1796,7 @@ make_quoted_replacement (char *match, int mtype, char *qc)
|
||||
if (do_replace != NO_MATCH && rl_filename_quoting_function)
|
||||
replacement = (*rl_filename_quoting_function) (match, do_replace, qc);
|
||||
}
|
||||
|
||||
return (replacement);
|
||||
}
|
||||
|
||||
|
||||
+29
-22
@@ -609,11 +609,18 @@ rl_expand_prompt (char *prompt)
|
||||
FREE (local_prompt);
|
||||
FREE (local_prompt_prefix);
|
||||
|
||||
/* Set default values for variables expand_prompt sets */
|
||||
local_prompt = local_prompt_prefix = (char *)0;
|
||||
local_prompt_len = 0;
|
||||
prompt_last_invisible = prompt_invis_chars_first_line = 0;
|
||||
prompt_visible_length = prompt_physical_chars = 0;
|
||||
|
||||
if (local_prompt_invis_chars == 0)
|
||||
{
|
||||
local_prompt_invis_chars = (int *)xmalloc (sizeof (int));
|
||||
local_prompt_invis_chars[0] = 0;
|
||||
}
|
||||
|
||||
if (prompt == 0 || *prompt == 0)
|
||||
return (0);
|
||||
|
||||
@@ -776,6 +783,28 @@ _rl_optimize_redisplay (void)
|
||||
_rl_quick_redisplay = 1;
|
||||
}
|
||||
|
||||
/* Useful shorthand used by rl_redisplay, update_line, rl_move_cursor_relative */
|
||||
#define INVIS_FIRST() (local_prompt_invis_chars[0])
|
||||
#define WRAP_OFFSET(line, offset) ((line <= prompt_last_screen_line) ? local_prompt_invis_chars[line] : 0)
|
||||
|
||||
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
|
||||
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
|
||||
#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
|
||||
#define VIS_CHARS(line) (visible_line + vis_lbreaks[line])
|
||||
#define VIS_FACE(line) (vis_face + vis_lbreaks[line])
|
||||
#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line)
|
||||
#define VIS_LINE_FACE(line) ((line) > _rl_vis_botlin) ? "" : VIS_FACE(line)
|
||||
#define INV_LINE(line) (invisible_line + inv_lbreaks[line])
|
||||
#define INV_LINE_FACE(line) (inv_face + inv_lbreaks[line])
|
||||
|
||||
#define INV_CHARS_CURRENT_PROMPT_LINE(line) \
|
||||
(local_prompt_invis_chars[line] > 0)
|
||||
|
||||
#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \
|
||||
_rl_last_c_pos != o_cpos && \
|
||||
_rl_last_c_pos > wrap_offset && \
|
||||
o_cpos < prompt_last_invisible)
|
||||
|
||||
/* Basic redisplay algorithm. See comments inline. */
|
||||
void
|
||||
rl_redisplay (void)
|
||||
@@ -1271,28 +1300,6 @@ rl_redisplay (void)
|
||||
second and subsequent lines start at inv_lbreaks[N], offset by
|
||||
OFFSET (which has already been calculated above). */
|
||||
|
||||
#define INVIS_FIRST() (local_prompt_invis_chars[0])
|
||||
#define WRAP_OFFSET(line, offset) ((line <= prompt_last_screen_line) ? local_prompt_invis_chars[line] : 0)
|
||||
|
||||
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
|
||||
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
|
||||
#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
|
||||
#define VIS_CHARS(line) (visible_line + vis_lbreaks[line])
|
||||
#define VIS_FACE(line) (vis_face + vis_lbreaks[line])
|
||||
#define VIS_LINE(line) ((line) > _rl_vis_botlin) ? "" : VIS_CHARS(line)
|
||||
#define VIS_LINE_FACE(line) ((line) > _rl_vis_botlin) ? "" : VIS_FACE(line)
|
||||
#define INV_LINE(line) (invisible_line + inv_lbreaks[line])
|
||||
#define INV_LINE_FACE(line) (inv_face + inv_lbreaks[line])
|
||||
|
||||
#define INV_CHARS_CURRENT_PROMPT_LINE(line) \
|
||||
(local_prompt_invis_chars[line] > 0)
|
||||
|
||||
#define OLD_CPOS_IN_PROMPT() (cpos_adjusted == 0 && \
|
||||
_rl_last_c_pos != o_cpos && \
|
||||
_rl_last_c_pos > wrap_offset && \
|
||||
o_cpos < prompt_last_invisible)
|
||||
|
||||
|
||||
/* We don't want to highlight anything that's going to be off the top
|
||||
of the display; if the current line takes up more than an entire
|
||||
screen, just mark the lines that won't be displayed as having a
|
||||
|
||||
Reference in New Issue
Block a user