map[i].function = (rl_command_func_t *)NULL;
rval = 1;
}
+ else if (map[i].type == ISKMAP) /* TAG:readline-8.1 */
+ {
+ int r;
+ r = rl_unbind_function_in_map (func, FUNCTION_TO_KEYMAP (map, i));
+ if (r == 1)
+ rval = 1;
+ }
}
return rval;
}
/* display.c -- readline redisplay facility. */
-/* 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.
extern char *strchr (), *strrchr ();
#endif /* !strchr && !__STDC__ */
-static void update_line PARAMS((char *, char *, int, int, int, int));
+static void putc_face PARAMS((int, int, char *));
+static void puts_face PARAMS((const char *, const char *, int));
+static void norm_face PARAMS((char *, int));
+
+static void update_line PARAMS((char *, char *, char *, char *, int, int, int, int));
static void space_to_eol PARAMS((int));
static void delete_chars PARAMS((int));
static void insert_some_chars PARAMS((char *, int, int));
static void open_some_spaces PARAMS((int));
static void cr PARAMS((void));
static void redraw_prompt PARAMS((char *));
+static void _rl_move_cursor_relative PARAMS((int, const char *, const char *));
/* Values for FLAGS */
#define PMT_MULTILINE 0x01
struct line_state
{
char *line;
+ char *lface;
int *lbreaks;
int lbsize;
#if defined (HANDLE_MULTIBYTE)
#define vis_lbsize (line_state_visible->lbsize)
#define visible_line (line_state_visible->line)
+#define vis_face (line_state_visible->lface)
#define invisible_line (line_state_invisible->line)
+#define inv_face (line_state_invisible->lface)
#if defined (HANDLE_MULTIBYTE)
static int _rl_col_width PARAMS((const char *, int, int, int));
to use prompt_last_invisible directly. */
#define PROMPT_ENDING_INDEX \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
+
+#define FACE_NORMAL '0'
+#define FACE_STANDOUT '1'
+#define FACE_INVALID ((char)1)
/* **************************************************************** */
/* */
static int forced_display;
/* Default and initial buffer size. Can grow. */
-static int line_size = DEFAULT_LINE_BUFFER_SIZE;
+static int line_size = 0;
/* Set to a non-zero value if horizontal scrolling has been enabled
automatically because the terminal was resized to height 1. */
}
}
+/* Allocate the various line structures, making sure they can hold MINSIZE
+ bytes. If the existing line size can accommodate MINSIZE bytes, don't do
+ anything. */
+static void
+realloc_line (int minsize)
+{
+ int minimum_size;
+ int newsize, delta;
+
+ minimum_size = DEFAULT_LINE_BUFFER_SIZE;
+ if (minsize < minimum_size)
+ minsize = minimum_size;
+ if (minsize <= _rl_screenwidth) /* XXX - for gdb */
+ minsize = _rl_screenwidth + 1;
+ if (line_size >= minsize)
+ return;
+
+ newsize = minimum_size;
+ while (newsize < minsize)
+ newsize *= 2;
+
+ visible_line = (char *)xrealloc (visible_line, newsize);
+ vis_face = (char *)xrealloc (vis_face, newsize);
+
+ invisible_line = (char *)xrealloc (invisible_line, newsize);
+ inv_face = (char *)xrealloc (inv_face, newsize);
+
+ delta = newsize - line_size;
+ memset (visible_line + line_size, 0, delta);
+ memset (vis_face + line_size, FACE_NORMAL, delta);
+ memset (invisible_line + line_size, 1, delta);
+ memset (inv_face + line_size, FACE_INVALID, delta);
+
+ line_size = newsize;
+}
+
/* Initialize the VISIBLE_LINE and INVISIBLE_LINE arrays, and their associated
arrays of line break markers. MINSIZE is the minimum size of VISIBLE_LINE
and INVISIBLE_LINE; if it is greater than LINE_SIZE, LINE_SIZE is
static void
init_line_structures (int minsize)
{
- register int n;
- int osize;
-
- osize = minsize;
- if (minsize <= _rl_screenwidth) /* XXX - for gdb */
- minsize = _rl_screenwidth + 1;
-
if (invisible_line == 0) /* initialize it */
{
- if (line_size < minsize)
- line_size = minsize;
- visible_line = (char *)xmalloc (line_size);
- invisible_line = (char *)xmalloc (line_size);
- }
- else if (line_size < minsize) /* ensure it can hold MINSIZE chars */
- {
- line_size *= 2;
- if (line_size < minsize)
- line_size = minsize;
- visible_line = (char *)xrealloc (visible_line, line_size);
- invisible_line = (char *)xrealloc (invisible_line, line_size);
- }
-
- for (n = osize; n < line_size; n++)
- {
- visible_line[n] = 0;
- invisible_line[n] = 1;
+ if (line_size > minsize)
+ minsize = line_size;
}
+ realloc_line (minsize);
if (vis_lbreaks == 0)
{
line_structures_initialized = 1;
}
+/* Convenience functions to add chars to the invisible line that update the
+ face information at the same time. */
+static void /* XXX - change this */
+invis_addc (int *outp, char c, char face)
+{
+ realloc_line (*outp + 1);
+ invisible_line[*outp] = c;
+ inv_face[*outp] = face;
+ *outp += 1;
+}
+
+static void
+invis_adds (int *outp, const char *str, int n, char face)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ invis_addc (outp, str[i], face);
+}
+
+static void
+invis_nul (int *outp)
+{
+ invis_addc (outp, '\0', 0);
+ *outp -= 1;
+}
+
+static void
+set_active_region (int *beg, int *end)
+{
+ if (rl_point >= 0 && rl_point <= rl_end && rl_mark >= 0 && rl_mark <= rl_end)
+ {
+ *beg = (rl_mark < rl_point) ? rl_mark : rl_point;
+ *end = (rl_mark < rl_point) ? rl_point : rl_mark;
+ }
+}
+
/* 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
void
rl_redisplay (void)
{
- register int in, out, c, linenum, cursor_linenum;
- register char *line;
+ int in, out, c, linenum, cursor_linenum;
int inv_botlin, lb_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, n0, num, prompt_lines_estimate;
char *prompt_this_line;
+ char cur_face;
+ int hl_begin, hl_end;
int mb_cur_max = MB_CUR_MAX;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
_rl_block_sigint ();
RL_SETSTATE (RL_STATE_REDISPLAYING);
+ cur_face = FACE_NORMAL;
+ /* Can turn this into an array for multiple highlighted objects in addition
+ to the region */
+ hl_begin = hl_end = -1;
+
+ if (rl_mark_active_p ())
+ set_active_region (&hl_begin, &hl_end);
+
if (!rl_display_prompt)
rl_display_prompt = "";
prompt_multibyte_chars = prompt_visible_length - prompt_physical_chars;
- line = invisible_line;
out = inv_botlin = 0;
/* Mark the line as modified or not. We only do this for history
modmark = 0;
if (_rl_mark_modified_lines && current_history () && rl_undo_list)
{
- line[out++] = '*';
- line[out] = '\0';
+ invis_addc (&out, '*', cur_face);
+ invis_nul (&out);
modmark = 1;
}
_rl_output_some_chars (local_prompt_prefix, strlen (local_prompt_prefix));
if (local_prompt_len > 0)
- {
- temp = local_prompt_len + out + 2;
- if (temp >= line_size)
- {
- line_size = (temp + 1024) - (temp % 1024);
- visible_line = (char *)xrealloc (visible_line, line_size);
- line = invisible_line = (char *)xrealloc (invisible_line, line_size);
- }
- strncpy (line + out, local_prompt, local_prompt_len);
- out += local_prompt_len;
- }
- line[out] = '\0';
+ invis_adds (&out, local_prompt, local_prompt_len, cur_face);
+ invis_nul (&out);
wrap_offset = local_prompt_len - prompt_visible_length;
}
else
}
prompt_physical_chars = pmtlen = strlen (prompt_this_line); /* XXX */
- temp = pmtlen + out + 2;
- if (temp >= line_size)
- {
- line_size = (temp + 1024) - (temp % 1024);
- visible_line = (char *)xrealloc (visible_line, line_size);
- line = invisible_line = (char *)xrealloc (invisible_line, line_size);
- }
- strncpy (line + out, prompt_this_line, pmtlen);
- out += pmtlen;
- line[out] = '\0';
+ invis_adds (&out, prompt_this_line, pmtlen, cur_face);
+ invis_nul (&out);
wrap_offset = prompt_invis_chars_first_line = 0;
}
for (in = 0; in < rl_end; in++)
#endif
{
+ if (in == hl_begin)
+ cur_face = FACE_STANDOUT;
+ else if (in == hl_end)
+ cur_face = FACE_NORMAL;
+
c = (unsigned char)rl_line_buffer[in];
#if defined (HANDLE_MULTIBYTE)
}
#endif
- if (out + 8 >= line_size) /* XXX - 8 for \t */
- {
- line_size *= 2;
- visible_line = (char *)xrealloc (visible_line, line_size);
- invisible_line = (char *)xrealloc (invisible_line, line_size);
- line = invisible_line;
- }
-
if (in == rl_point)
{
cpos_buffer_position = out;
{
if (_rl_output_meta_chars == 0)
{
- sprintf (line + out, "\\%o", c);
+ char obuf[5];
+ int olen;
- if (lpos + 4 >= _rl_screenwidth)
+ olen = sprintf (obuf, "\\%o", c);
+
+ if (lpos + olen >= _rl_screenwidth)
{
temp = _rl_screenwidth - lpos;
CHECK_INV_LBREAKS ();
#if defined (HANDLE_MULTIBYTE)
line_state_invisible->wrapped_line[newlines] = _rl_wrapped_multicolumn;
#endif
- lpos = 4 - temp;
+ lpos = olen - temp;
}
else
- lpos += 4;
+ lpos += olen;
- out += 4;
+ for (temp = 0; temp < olen; temp++)
+ {
+ invis_addc (&out, obuf[temp], cur_face);
+ CHECK_LPOS ();
+ }
}
else
{
- line[out++] = c;
+ invis_addc (&out, c, cur_face);
CHECK_LPOS();
}
}
#endif
lpos = temp - temp2;
while (out < newout)
- line[out++] = ' ';
+ invis_addc (&out, ' ', cur_face);
}
else
{
while (out < newout)
- line[out++] = ' ';
+ invis_addc (&out, ' ', cur_face);
lpos += temp;
}
}
#endif
else if (c == '\n' && _rl_horizontal_scroll_mode == 0 && _rl_term_up && *_rl_term_up)
{
- line[out++] = '\0'; /* XXX - sentinel */
+ invis_addc (&out, '\0', cur_face);
CHECK_INV_LBREAKS ();
inv_lbreaks[++newlines] = out;
#if defined (HANDLE_MULTIBYTE)
}
else if (CTRL_CHAR (c) || c == RUBOUT)
{
- line[out++] = '^';
+ invis_addc (&out, '^', cur_face);
CHECK_LPOS();
- line[out++] = CTRL_CHAR (c) ? UNCTRL (c) : '?';
+ invis_addc (&out, CTRL_CHAR (c) ? UNCTRL (c) : '?', cur_face);
CHECK_LPOS();
}
else
for (i = lpos; i < _rl_screenwidth; i++)
{
/* The space will be removed in update_line() */
- line[out++] = ' ';
+ invis_addc (&out, ' ', cur_face);
_rl_wrapped_multicolumn++;
CHECK_LPOS();
}
lb_linenum = newlines;
}
for (i = in; i < in+wc_bytes; i++)
- line[out++] = rl_line_buffer[i];
+ invis_addc (&out, rl_line_buffer[i], cur_face);
for (i = 0; i < wc_width; i++)
CHECK_LPOS();
}
else
{
- line[out++] = c;
+ invis_addc (&out, c, cur_face);
CHECK_LPOS();
}
#else
- line[out++] = c;
+ invis_addc (&out, c, cur_face);
CHECK_LPOS();
#endif
}
in++;
#endif
}
- line[out] = '\0';
+ invis_nul (&out);
line_totbytes = out;
if (cpos_buffer_position < 0)
{
{
#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
- out = _rl_find_prev_mbchar (line, _rl_screenchars, MB_FIND_ANY);
+ out = _rl_find_prev_mbchar (invisible_line, _rl_screenchars, MB_FIND_ANY);
else
#endif
out = _rl_screenchars - 1;
#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 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
+ `normal' face.
+ It's imperfect, but better than display corruption. */
+ if (rl_mark_active_p () && inv_botlin > _rl_screenheight)
+ {
+ int extra;
+
+ extra = inv_botlin - _rl_screenheight;
+ for (linenum = 0; linenum <= extra; linenum++)
+ norm_face (INV_LINE_FACE(linenum), INV_LLEN (linenum));
+ }
+
/* For each line in the buffer, do the updating display. */
for (linenum = 0; linenum <= inv_botlin; linenum++)
{
the locale from a non-multibyte to a multibyte one. */
o_cpos = _rl_last_c_pos;
cpos_adjusted = 0;
- update_line (VIS_LINE(linenum), INV_LINE(linenum), linenum,
+ update_line (VIS_LINE(linenum), VIS_LINE_FACE(linenum),
+ INV_LINE(linenum), INV_LINE_FACE(linenum),
+ linenum,
VIS_LLEN(linenum), INV_LLEN(linenum), inv_botlin);
/* update_line potentially changes _rl_last_c_pos, but doesn't
{
tt = VIS_CHARS (linenum);
_rl_move_vert (linenum);
- _rl_move_cursor_relative (0, tt);
+ _rl_move_cursor_relative (0, tt, VIS_FACE(linenum));
_rl_clear_to_eol
((linenum == _rl_vis_botlin) ? strlen (tt) : _rl_screenwidth);
}
/* XXX - why not use local_prompt_len? */
nleft = prompt_visible_length + wrap_offset;
if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
-#if 0
- _rl_last_c_pos <= PROMPT_ENDING_INDEX && local_prompt)
-#else
_rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt)
-#endif
{
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- if (_rl_term_cr)
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
point specified by a buffer position (NLEFT) that doesn't take
invisible characters into account. */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
- _rl_move_cursor_relative (nleft, &invisible_line[pos]);
+ _rl_move_cursor_relative (nleft, &invisible_line[pos], &inv_face[pos]);
else if (nleft != _rl_last_c_pos)
- _rl_move_cursor_relative (nleft, &invisible_line[pos]);
+ _rl_move_cursor_relative (nleft, &invisible_line[pos], &inv_face[pos]);
}
}
else /* Do horizontal scrolling. Much simpler */
/* If the first character on the screen isn't the first character
in the display line, indicate this with a special character. */
if (lmargin > 0)
- line[lmargin] = '<';
+ invisible_line[lmargin] = '<';
/* If SCREENWIDTH characters starting at LMARGIN do not encompass
the whole line, indicate that with a special character at the
wrap offset into account. */
t = lmargin + M_OFFSET (lmargin, wrap_offset) + _rl_screenwidth;
if (t > 0 && t < out)
- line[t - 1] = '>';
+ invisible_line[t - 1] = '>';
if (rl_display_fixed == 0 || forced_display || lmargin != last_lmargin)
{
forced_display = 0;
o_cpos = _rl_last_c_pos;
cpos_adjusted = 0;
- update_line (&visible_line[last_lmargin],
- &invisible_line[lmargin],
+ update_line (&visible_line[last_lmargin], &vis_face[last_lmargin],
+ &invisible_line[lmargin], &inv_face[lmargin],
0,
_rl_screenwidth + visible_wrap_offset,
_rl_screenwidth + (lmargin ? 0 : wrap_offset),
if (visible_first_line_len > _rl_screenwidth)
visible_first_line_len = _rl_screenwidth;
- _rl_move_cursor_relative (cpos_buffer_position - lmargin, &invisible_line[lmargin]);
+ _rl_move_cursor_relative (cpos_buffer_position - lmargin, &invisible_line[lmargin], &inv_face[lmargin]);
last_lmargin = lmargin;
}
}
_rl_release_sigint ();
}
+static void
+putc_face (int c, int face, char *cur_face)
+{
+ char cf;
+ cf = *cur_face;
+ if (cf != face)
+ {
+ if (cf != FACE_NORMAL && cf != FACE_STANDOUT)
+ return;
+ if (face != FACE_NORMAL && face != FACE_STANDOUT)
+ return;
+ if (face == FACE_STANDOUT && cf == FACE_NORMAL)
+ _rl_standout_on ();
+ if (face == FACE_NORMAL && cf == FACE_STANDOUT)
+ _rl_standout_off ();
+ *cur_face = face;
+ }
+ if (c != EOF)
+ putc (c, rl_outstream);
+}
+
+static void
+puts_face (const char *str, const char *face, int n)
+{
+ int i;
+ char cur_face;
+
+ for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
+ putc_face (str[i], face[i], &cur_face);
+ putc_face (EOF, FACE_NORMAL, &cur_face);
+}
+
+static void
+norm_face (char *face, int n)
+{
+ memset (face, FACE_NORMAL, n);
+}
+
#define ADJUST_CPOS(x) do { _rl_last_c_pos -= (x) ; cpos_adjusted = 1; } while (0)
/* PWP: update_line() is based on finding the middle difference of each
line on the screen; vis:
/old first difference
- /beginning of line | /old last same /old EOL
- v v v v
+ /beginning of line | /old last same /old EOL
+ v v v v
old: eddie> Oh, my little gruntle-buggy is to me, as lurgid as
new: eddie> Oh, my little buggy says to me, as lurgid as
- ^ ^ ^ ^
- \beginning of line | \new last same \new end of line
+ ^ ^ ^ ^
+ \beginning of line | \new last same \new end of line
\new first difference
All are character pointers for the sake of speed. Special cases for
Could be made even smarter, but this works well enough */
static void
-update_line (char *old, char *new, int current_line, int omax, int nmax, int inv_botlin)
+update_line (char *old, char *old_face, char *new, char *new_face, int current_line, int omax, int nmax, int inv_botlin)
{
- register char *ofd, *ols, *oe, *nfd, *nls, *ne;
+ char *ofd, *ols, *oe, *nfd, *nls, *ne;
+ char *ofdf, *nfdf, *olsf, *nlsf;
int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
int count, i, j;
char *optr;
- _rl_output_some_chars (new, newbytes);
+ puts_face (new, new_face, newbytes);
_rl_last_c_pos = newwidth;
_rl_last_v_pos++;
ne = new + nmax;
nd = newbytes;
nfd = new + nd;
+ ofdf = old_face + oldbytes;
+ nfdf = new_face + newbytes;
+
goto dumb_update;
}
if (oldbytes != 0 && newbytes != 0)
/* Don't bother trying to fit the bytes if the number of bytes
doesn't change. */
if (oldbytes != newbytes)
- memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1);
+ {
+ memmove (old+newbytes, old+oldbytes, strlen (old+oldbytes) + 1);
+ memmove (old_face+newbytes, old_face+oldbytes, strlen (old+oldbytes) + 1);
+ }
memcpy (old, new, newbytes);
+ memcpy (old_face, new_face, newbytes);
j = newbytes - oldbytes;
omax += j;
/* Fix up indices if we copy data from one line to another */
_rl_last_c_pos = 1;
_rl_last_v_pos++;
if (old[0] && new[0])
- old[0] = new[0];
+ {
+ old[0] = new[0];
+ old_face[0] = new_face[0];
+ }
}
}
else
#endif
{
if (new[0])
- putc (new[0], rl_outstream);
+ puts_face (new, new_face, 1);
else
putc (' ', rl_outstream);
_rl_last_c_pos = 1;
_rl_last_v_pos++;
if (old[0] && new[0])
- old[0] = new[0];
+ {
+ old[0] = new[0];
+ old_face[0] = new_face[0];
+ }
}
}
if (_rl_quick_redisplay)
{
nfd = new;
+ nfdf = new_face;
ofd = old;
+ ofdf = old_face;
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);
+ _rl_move_cursor_relative (0, old, old_face);
bytes_to_insert = ne - nfd;
if (bytes_to_insert < local_prompt_len) /* ??? */
bytes_to_insert -= local_prompt_len;
if (bytes_to_insert > 0)
{
- _rl_output_some_chars (new+local_prompt_len, bytes_to_insert);
+ puts_face (new+local_prompt_len, nfdf+local_prompt_len, bytes_to_insert);
if (mb_cur_max > 1 && rl_byte_oriented)
_rl_last_c_pos += _rl_col_width (new, local_prompt_len, ne-new, 1);
else
/* See if the old line is a subset of the new line, so that the
only change is adding characters. */
temp = (omax < nmax) ? omax : nmax;
- if (memcmp (old, new, temp) == 0) /* adding at the end */
+ if (memcmp (old, new, temp) == 0 && memcmp (old_face, new_face, temp) == 0)
{
- new_offset = old_offset = temp;
+ new_offset = old_offset = temp; /* adding at the end */
ofd = old + temp;
+ ofdf = old_face + temp;
nfd = new + temp;
+ nfdf = new_face + temp;
}
else
{
memset (&ps_old, 0, sizeof(mbstate_t));
/* Are the old and new lines the same? */
- if (omax == nmax && memcmp (new, old, omax) == 0)
+ if (omax == nmax && memcmp (new, old, omax) == 0 && memcmp (new_face, old_face, omax) == 0)
{
old_offset = omax;
new_offset = nmax;
ofd = old + omax;
+ ofdf = old_face + omax;
nfd = new + nmax;
+ nfdf = new_face + nmax;
}
else
{
/* Go through the line from the beginning and find the first
- difference. */
+ difference. We assume that faces change at (possibly multi-
+ byte) character boundaries. */
new_offset = old_offset = 0;
- for (ofd = old, nfd = new;
+ for (ofd = old, ofdf = old_face, nfd = new, nfdf = new_face;
(ofd - old < omax) && *ofd &&
- _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new); )
+ _rl_compare_chars(old, old_offset, &ps_old, new, new_offset, &ps_new) &&
+ *ofdf == *nfdf; )
{
old_offset = _rl_find_next_mbchar (old, old_offset, 1, MB_FIND_ANY);
new_offset = _rl_find_next_mbchar (new, new_offset, 1, MB_FIND_ANY);
ofd = old + old_offset;
+ ofdf = old_face + old_offset;
nfd = new + new_offset;
+ nfdf = new_face + new_offset;
}
}
}
}
else
#endif
- for (ofd = old, nfd = new;
- (ofd - old < omax) && *ofd && (*ofd == *nfd);
- ofd++, nfd++)
+ for (ofd = old, ofdf = old_face, nfd = new, nfdf = new_face;
+ (ofd - old < omax) && *ofd && (*ofd == *nfd) && (*ofdf == *nfdf);
+ ofd++, nfd++, ofdf++, nfdf++)
;
/* Move to the end of the screen line. ND and OD are used to keep track
old_offset = _rl_find_prev_mbchar (old, ofd - old, MB_FIND_ANY);
new_offset = _rl_find_prev_mbchar (new, nfd - new, MB_FIND_ANY);
ofd = old + old_offset; /* equal by definition */
+ ofdf = old_face + old_offset;
nfd = new + new_offset;
+ nfdf = new_face + new_offset;
}
}
#endif
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
ols = old + _rl_find_prev_mbchar (old, oe - old, MB_FIND_ANY);
+ olsf = old_face + (ols - old);
nls = new + _rl_find_prev_mbchar (new, ne - new, MB_FIND_ANY);
+ nlsf = new_face + (nls - new);
while ((ols > ofd) && (nls > nfd))
{
memset (&ps_old, 0, sizeof (mbstate_t));
memset (&ps_new, 0, sizeof (mbstate_t));
- if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0)
+ if (_rl_compare_chars (old, ols - old, &ps_old, new, nls - new, &ps_new) == 0 ||
+ *olsf != *nlsf)
break;
if (*ols == ' ')
wsatend = 0;
ols = old + _rl_find_prev_mbchar (old, ols - old, MB_FIND_ANY);
+ olsf = old_face + (ols - old);
nls = new + _rl_find_prev_mbchar (new, nls - new, MB_FIND_ANY);
+ nlsf = new_face + (nls - new);
}
}
else
{
#endif /* HANDLE_MULTIBYTE */
ols = oe - 1; /* find last same */
+ olsf = old_face + (ols - old);
nls = ne - 1;
- while ((ols > ofd) && (nls > nfd) && (*ols == *nls))
+ nlsf = new_face + (nls - new);
+ while ((ols > ofd) && (nls > nfd) && (*ols == *nls) && (*olsf == *nlsf))
{
if (*ols != ' ')
wsatend = 0;
- ols--;
- nls--;
+ ols--; olsf--;
+ nls--; nlsf--;
}
#if defined (HANDLE_MULTIBYTE)
}
if (wsatend)
{
ols = oe;
+ olsf = old_face + (ols - old);
nls = ne;
+ nlsf = new_face + (nls - new);
}
#if defined (HANDLE_MULTIBYTE)
/* This may not work for stateful encoding, but who cares? To handle
stateful encoding properly, we have to scan each string from the
beginning and compare. */
- else if (_rl_compare_chars (ols, 0, NULL, nls, 0, NULL) == 0)
+ else if (_rl_compare_chars (ols, 0, NULL, nls, 0, NULL) == 0 || *olsf != *nlsf)
#else
- else if (*ols != *nls)
+ else if (*ols != *nls || *olsf != *nlsf)
#endif
{
if (*ols) /* don't step past the NUL */
else
nls++;
}
+ olsf = old_face + (ols - old);
+ nlsf = new_face + (nls - new);
}
/* count of invisible characters in the current invisible line. */
(((od > 0 || nd > 0) && (od <= prompt_last_invisible || nd <= prompt_last_invisible)) ||
((od >= lendiff) && _rl_last_c_pos < PROMPT_ENDING_INDEX)))
{
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
if (modmark)
_rl_output_some_chars ("*", 1);
_rl_output_some_chars (local_prompt, lendiff);
if ((od <= prompt_last_invisible || nd <= prompt_last_invisible))
{
nfd = new + lendiff; /* number of characters we output above */
+ nfdf = new_face + lendiff;
nd = lendiff;
/* Do a dumb update and return */
temp = ne - nfd;
if (temp > 0)
{
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
_rl_last_c_pos += _rl_col_width (new, nd, ne - new, 1);
/* When this function returns, _rl_last_c_pos is correct, and an absolute
cursor position in multibyte mode, but a buffer index when not in a
multibyte locale. */
- _rl_move_cursor_relative (od, old);
+ _rl_move_cursor_relative (od, old, old_face);
#if defined (HANDLE_MULTIBYTE)
/* We need to indicate that the cursor position is correct in the presence of
: _rl_col_width (new, 0, nls - new, 1);
/* if we changed nls and ols, we need to recompute lendiff */
lendiff = (nls - nfd) - (ols - ofd);
+
+ nlsf = new_face + (nls - new);
+ olsf = old_face + (ols - old);
}
else
newwidth = _rl_col_width (new, nfd - new, nls - new, 1);
only happen in a multibyte environment. */
if (lendiff < 0)
{
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
/* If nfd begins before any invisible characters in the prompt,
adjust _rl_last_c_pos to account for wrap_offset and set
(visible_wrap_offset >= current_invis_chars))
{
open_some_spaces (col_lendiff);
- _rl_output_some_chars (nfd, bytes_to_insert);
+ puts_face (nfd, nfdf, bytes_to_insert);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
_rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1);
else
{
/* At the end of a line the characters do not have to
be "inserted". They can just be placed on the screen. */
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
return;
}
else /* just write from first difference to end of new line */
{
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
/* If nfd begins before the last invisible character in the
prompt, adjust _rl_last_c_pos to account for wrap_offset
else
{
/* cannot insert chars, write to EOL */
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp;
/* If we're in a multibyte locale and were before the last invisible
char in the current line (which implies we just output some invisible
characters in the prompt, we need to adjust _rl_last_c_pos
in a multibyte locale to account for the wrap offset and
set cpos_adjusted accordingly. */
- _rl_output_some_chars (nfd, bytes_to_insert);
+ puts_face (nfd, nfdf, bytes_to_insert);
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
/* This still doesn't take into account whether or not the
so we move there with _rl_move_cursor_relative */
if (_rl_horizontal_scroll_mode && ((oe-old) > (ne-new)))
{
- _rl_move_cursor_relative (ne-new, new);
+ _rl_move_cursor_relative (ne-new, new, new_face);
goto clear_rest_of_line;
}
}
characters in the prompt, we need to adjust _rl_last_c_pos
in a multibyte locale to account for the wrap offset and
set cpos_adjusted accordingly. */
- _rl_output_some_chars (nfd, temp);
+ puts_face (nfd, nfdf, temp);
_rl_last_c_pos += col_temp; /* XXX */
if (mb_cur_max > 1 && rl_byte_oriented == 0)
{
int curr_line;
/* Make sure we move to column 0 so we clear the entire line */
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
_rl_last_c_pos = 0;
/* Move to the last screen line of the current visible line */
DATA is the contents of the screen line of interest; i.e., where
the movement is being done.
DATA is always the visible line or the invisible line */
-void
-_rl_move_cursor_relative (int new, const char *data)
+static void
+_rl_move_cursor_relative (int new, const char *data, const char *dataf)
{
register int i;
int woff; /* number of invisible chars on current line */
if (dpos == 0 || CR_FASTER (dpos, _rl_last_c_pos) ||
(_rl_term_autowrap && i == _rl_screenwidth))
{
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif /* !__MSDOS__ */
+ _rl_cr ();
cpos = _rl_last_c_pos = 0;
}
}
else
{
- tputs (_rl_term_cr, 1, _rl_output_character_function);
- for (i = 0; i < new; i++)
- putc (data[i], rl_outstream);
+ _rl_cr ();
+ puts_face (data, dataf, new);
}
}
else
- for (i = cpos; i < new; i++)
- putc (data[i], rl_outstream);
+ puts_face (data + cpos, dataf + cpos, new - cpos);
}
#if defined (HANDLE_MULTIBYTE)
{
for (i = 0; i < delta; i++)
putc ('\n', rl_outstream);
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
_rl_last_c_pos = 0;
}
else
}
void
-_rl_clear_screen (void)
+_rl_clear_screen (int clrscr)
{
#if defined (__DJGPP__)
ScreenClear ();
ScreenSetCursor (0, 0);
#else
if (_rl_term_clrpag)
- tputs (_rl_term_clrpag, 1, _rl_output_character_function);
+ {
+ tputs (_rl_term_clrpag, 1, _rl_output_character_function);
+ if (clrscr && _rl_term_clrscroll)
+ tputs (_rl_term_clrscroll, 1, _rl_output_character_function);
+ }
else
rl_crlf ();
#endif /* __DJGPP__ */
/* If we've wrapped lines, remove the final xterm line-wrap flag. */
if (full_lines && _rl_term_autowrap && botline_length == _rl_screenwidth)
{
- char *last_line;
+ char *last_line, *last_face;
/* LAST_LINE includes invisible characters, so if you want to get the
last character of the first line, you have to take WOFF into account.
which takes a buffer position as the first argument, and any direct
subscripts of LAST_LINE. */
last_line = &visible_line[vis_lbreaks[_rl_vis_botlin]]; /* = VIS_CHARS(_rl_vis_botlin); */
+ last_face = &vis_face[vis_lbreaks[_rl_vis_botlin]]; /* = VIS_CHARS(_rl_vis_botlin); */
cpos_buffer_position = -1; /* don't know where we are in buffer */
- _rl_move_cursor_relative (_rl_screenwidth - 1 + woff, last_line); /* XXX */
+ _rl_move_cursor_relative (_rl_screenwidth - 1 + woff, last_line, last_face); /* XXX */
_rl_clear_to_eol (0);
- putc (last_line[_rl_screenwidth - 1 + woff], rl_outstream);
+ puts_face (&last_line[_rl_screenwidth - 1 + woff],
+ &last_face[_rl_screenwidth - 1 + woff], 1);
}
_rl_vis_botlin = 0;
if (botline_length > 0 || _rl_last_c_pos > 0)
static void
cr (void)
{
- if (_rl_term_cr)
- {
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
- _rl_last_c_pos = 0;
- }
+ _rl_cr ();
+ _rl_last_c_pos = 0;
}
/* Redraw the last line of a multi-line prompt that may possibly contain
{
_rl_move_vert (_rl_vis_botlin);
-#if defined (__MSDOS__)
- putc ('\r', rl_outstream);
-#else
- tputs (_rl_term_cr, 1, _rl_output_character_function);
-#endif
+ _rl_cr ();
_rl_last_c_pos = 0;
-#if defined (__MSDOS__)
- space_to_eol (_rl_screenwidth);
- putc ('\r', rl_outstream);
-#else
+
+#if !defined (__MSDOS__)
if (_rl_term_clreol)
tputs (_rl_term_clreol, 1, _rl_output_character_function);
else
+#endif
{
space_to_eol (_rl_screenwidth);
- tputs (_rl_term_cr, 1, _rl_output_character_function);
+ _rl_cr ();
}
-#endif
+
if (_rl_last_v_pos > 0)
_rl_move_vert (0);
}
return ret;
}
+void
+_rl_refresh_line (void)
+{
+ rl_clear_visible_line ();
+ rl_redraw_prompt_last_line ();
+ rl_keep_mark_active ();
+}
+
#if defined (HANDLE_MULTIBYTE)
/* Calculate the number of screen columns occupied by STR from START to END.
In the case of multibyte characters with stateful encoding, we have to
.SH NAME
history \- GNU History Library
.SH COPYRIGHT
-.if t The GNU History Library is Copyright \(co 1989-2017 by the Free Software Foundation, Inc.
-.if n The GNU History Library is Copyright (C) 1989-2017 by the Free Software Foundation, Inc.
+.if t The GNU History Library is Copyright \(co 1989-2020 by the Free Software Foundation, Inc.
+.if n The GNU History Library is Copyright (C) 1989-2020 by the Free Software Foundation, Inc.
.SH DESCRIPTION
Many programs read input from the user a line at a time. The GNU
History library is able to keep track of those lines, associate arbitrary
composing new ones.
.PP
.SH "HISTORY EXPANSION"
-.PP
The history library supports a history expansion feature that
is identical to the history expansion in
.BR bash.
Only backslash (\^\fB\e\fP\^) and single quotes can quote
the history expansion character.
.SS Event Designators
-.PP
An event designator is a reference to a command line entry in the
history list.
Unless the reference is absolute, events are relative to the current
The entire command line typed so far.
.PD
.SS Word Designators
-.PP
Word designators are used to select desired words from the event.
A
.B :
If a word designator is supplied without an event specification, the
previous command is used as the event.
.SS Modifiers
-.PP
After the optional word designator, there may appear a sequence of
one or more of the following modifiers, each preceded by a `:'.
These modify, or edit, the word or words selected from the history event.
.SH "PROGRAMMING WITH HISTORY FUNCTIONS"
This section describes how to use the History library in other programs.
.SS Introduction to History
-.PP
The programmer using the History library has available functions
for remembering lines on a history list, associating arbitrary data
with a line, removing lines from the list, searching through the list
History library's features. It supplies extern declarations for all
of the library's public functions and variables, and declares all of
the public data structures.
-
.SS History Storage
-.PP
The history list is an array of history entries. A history entry is
declared as follows:
.PP
If the flags member includes \fBHS_STIFLED\fP, the history has been
stifled.
.SH "History Functions"
-.PP
This section describes the calling sequence for the various functions
exported by the GNU History library.
.SS Initializing History and State Management
Set the state of the history list according to \fIstate\fP.
.SS History List Management
-
These functions manage individual entries on the history list, or set
parameters managing the list itself.
The maximum number of history entries. This must be changed using
\fBstifle_history()\fP.
-.Vb int history_wite_timestamps
+.Vb int history_write_timestamps
If non-zero, timestamps are written to the history file, so they can be
preserved between sessions. The default value is 0, meaning that
timestamps are not saved.
a programming tool that provides a consistent user interface for
recalling lines of previously typed input.
-Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@ignore
This file documents the user interface to the GNU History library.
-Copyright (C) 1988--2018 Free Software Foundation, Inc.
+Copyright (C) 1988--2020 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
Permission is granted to make and distribute verbatim copies of this manual
@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
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
-.\" Last Change: Mon Nov 25 10:53:27 EST 2019
+.\" Last Change: Tue Mar 24 09:27:30 EDT 2020
.\"
-.TH READLINE 3 "2019 November 25" "GNU Readline 8.0"
+.TH READLINE 3 "2020 March 24" "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.
\fBreadline\fP (\fIconst char *prompt\fP);
.fi
.SH COPYRIGHT
-.if n Readline is Copyright (C) 1989\-2014 Free Software Foundation, Inc.
-.if t Readline is Copyright \(co 1989\-2014 Free Software Foundation, Inc.
+.if n Readline is Copyright (C) 1989\-2020 Free Software Foundation, Inc.
+.if t Readline is Copyright \(co 1989\-2020 Free Software Foundation, Inc.
.SH DESCRIPTION
.LP
.B readline
to a string that is inserted when the key is pressed (a \fImacro\fP).
.PP
.SS Key Bindings
-.PP
The syntax for controlling key bindings in the
.I inputrc
file is simple. All that is required is the name of the
file may be edited and re-read if a program does not provide
any other means to incorporate new bindings.
.SS Variables
-.PP
Readline has variables that can be used to further customize its
behavior. A variable may be set in the
.I inputrc
completions.
.PD
.SS Conditional Constructs
-.PP
Readline implements a facility similar in spirit to the conditional
compilation features of the C preprocessor which allows key
bindings and variable settings to be performed as the result
.fi
.RE
.SH SEARCHING
-.PP
Readline provides commands for searching through the command history
for lines containing a specified string.
There are two search modes:
to search for matching history lines. The search string may be
typed by the user or be part of the contents of the current line.
.SH EDITING COMMANDS
-.PP
The following is a list of the names of the commands and the default
key sequences to which they are bound.
Command names without an accompanying key sequence are unbound by default.
\fBset\-mark\fP command.
The text between the point and mark is referred to as the \fIregion\fP.
.SS Commands for Moving
-.PP
.PD 0
.TP
.B beginning\-of\-line (C\-a)
of the current Readline line is not greater than the length of the prompt
plus the screen width.
.TP
+.B clear\-display (M\-C\-l)
+Clear the screen and, if possible, the terminal's scrollback buffer,
+then redraw the current line,
+leaving the current line at the top of the screen.
+.TP
.B clear\-screen (C\-l)
-Clear the screen leaving the current line at the top of the screen.
+Clear the screen,
+then redraw the current line,
+leaving the current line at the top of the screen.
With an argument, refresh the current line without clearing the
screen.
.TP
Refresh the current line.
.PD
.SS Commands for Manipulating the History
-.PP
.PD 0
.TP
.B accept\-line (Newline, Return)
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
-.PP
.PD 0
.TP
.B \fIend\-of\-file\fP (usually C\-d)
before point with a space. By default, this command is unbound.
.PD
.SS Killing and Yanking
-.PP
.PD 0
.TP
.B kill\-line (C\-k)
.BR yank\-pop .
.PD
.SS Numeric Arguments
-.PP
.PD 0
.TP
.B digit\-argument (M\-0, M\-1, ..., M\-\-)
argument count sixteen, and so on.
.PD
.SS Completing
-.PP
.PD 0
.TP
.B complete (TAB)
\fBpossible-completions\fP.
.PD
.SS Keyboard Macros
-.PP
.PD 0
.TP
.B start\-kbd\-macro (C\-x (\^)
\fIinputrc\fP file.
.PD
.SS Miscellaneous
-.PP
.PD 0
.TP
.B re\-read\-init\-file (C\-x C\-r)
"M-C-H" backward-kill-word
"M-C-I" tab-insert
"M-C-J" vi-editing-mode
+"M-C-L" clear-display
"M-C-M" vi-editing-mode
"M-C-R" revert-line
"M-C-Y" yank-nth-arg
this manual page should be directed to
.IR chet.ramey@case.edu .
.SH BUGS
-.PP
It's too big and too slow.
consistency of user interface across discrete programs which provide
a command line interface.
-Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
in the consistency of user interface across discrete programs that need
to provide a command line interface.
-Copyright (C) 1988--2019 Free Software Foundation, Inc.
+Copyright (C) 1988--2020 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
which contains both end-user and programmer documentation for the
GNU Readline Library.
-Copyright (C) 1988--2016 Free Software Foundation, Inc.
+Copyright (C) 1988--2020 Free Software Foundation, Inc.
Authored by Brian Fox and Chet Ramey.
of the current Readline line is not greater than the length of the prompt
plus the screen width.
+@item clear-display (M-C-l)
+Clear the screen and, if possible, the terminal's scrollback buffer,
+then redraw the current line,
+leaving the current line at the top of the screen.
+
@item clear-screen (C-l)
-Clear the screen and redraw the current line,
+Clear the screen,
+then redraw the current line,
leaving the current line at the top of the screen.
@item redraw-current-line ()
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
@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.
consistency of user interface across discrete programs which provide
a command line interface.
-Copyright @copyright{} 1988--2016 Free Software Foundation, Inc.
+Copyright @copyright{} 1988--2020 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@ignore
-Copyright (C) 1988-2019 Free Software Foundation, Inc.
+Copyright (C) 1988-2020 Free Software Foundation, Inc.
@end ignore
@set EDITION 8.0
@set VERSION 8.0
-@set UPDATED 25 November 2019
-@set UPDATED-MONTH November 2019
+@set UPDATED 4 May 2020
+@set UPDATED-MONTH May 2020
-@set LASTCHANGE Mon Nov 25 10:53:13 EST 2019
+@set LASTCHANGE Mon May 4 14:55:02 EDT 2020
{ 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 */
{ ISFUNC, rl_tab_insert }, /* Meta-Control-i */
{ ISFUNC, rl_vi_editing_mode }, /* Meta-Control-j */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-k */
- { ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-l */
+ { ISFUNC, rl_clear_display }, /* Meta-Control-l */
{ ISFUNC, rl_vi_editing_mode }, /* Meta-Control-m */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-n */
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Meta-Control-o */
{ "capitalize-word", rl_capitalize_word },
{ "character-search", rl_char_search },
{ "character-search-backward", rl_backward_char_search },
+ { "clear-display", rl_clear_display },
{ "clear-screen", rl_clear_screen },
{ "complete", rl_complete },
{ "copy-backward-word", rl_copy_backward_word },
{ "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 },
return (history_rename (backup, orig));
}
+/* Should we call chown, based on whether finfo and nfinfo describe different
+ files with different owners? */
+
+#define SHOULD_CHOWN(finfo, nfinfo) \
+ (finfo.st_uid != nfinfo.st_uid || finfo.st_gid != nfinfo.st_gid)
+
/* Truncate the history file FNAME, leaving only LINES trailing lines.
If FNAME is NULL, then use ~/.history. Writes a new file and renames
it to the original name. Returns 0 on success, errno on failure. */
{
char *buffer, *filename, *tempname, *bp, *bp1; /* bp1 == bp+1 */
int file, chars_read, rv, orig_lines, exists, r;
- struct stat finfo;
+ struct stat finfo, nfinfo;
size_t file_size;
history_lines_written_to_file = 0;
}
exists = 1;
+ nfinfo.st_uid = finfo.st_uid;
+ nfinfo.st_gid = finfo.st_gid;
+
if (S_ISREG (finfo.st_mode) == 0)
{
close (file);
if (write (file, bp, chars_read - (bp - buffer)) < 0)
rv = errno;
+ if (fstat (file, &nfinfo) < 0 && rv == 0)
+ rv = errno;
+
if (close (file) < 0 && rv == 0)
rv = errno;
}
user is running this, it's a no-op. If the shell is running after sudo
with a shared history file, we don't want to leave the history file
owned by root. */
- if (rv == 0 && exists)
+ if (rv == 0 && exists && SHOULD_CHOWN (finfo, nfinfo))
r = chown (filename, finfo.st_uid, finfo.st_gid);
#endif
register int i;
char *output, *tempname, *histname;
int file, mode, rv, exists;
- struct stat finfo;
+ struct stat finfo, nfinfo;
#ifdef HISTORY_USE_MMAP
size_t cursize;
the_history = history_list ();
/* Calculate the total number of bytes to write. */
for (buffer_size = 0, i = history_length - nelements; i < history_length; i++)
-#if 0
- buffer_size += 2 + HISTENT_BYTES (the_history[i]);
-#else
{
if (history_write_timestamps && the_history[i]->timestamp && the_history[i]->timestamp[0])
buffer_size += strlen (the_history[i]->timestamp) + 1;
buffer_size += strlen (the_history[i]->line) + 1;
}
-#endif
/* Allocate the buffer, and fill it. */
#ifdef HISTORY_USE_MMAP
FD_ZERO (&exceptfds);
FD_SET (tty, &readfds);
FD_SET (tty, &exceptfds);
- timeout.tv_sec = 0;
- timeout.tv_usec = _keyboard_input_timeout;
+ USEC_TO_TIMEVAL (_keyboard_input_timeout, timeout);
return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0);
#else
return 0;
}
+int
+_rl_nchars_available ()
+{
+ int chars_avail, fd, result;
+
+ chars_avail = 0;
+
+#if defined (FIONREAD)
+ fd = fileno (rl_instream);
+ errno = 0;
+ result = ioctl (fd, FIONREAD, &chars_avail);
+ if (result == -1 && errno == EIO)
+ return -1;
+#endif
+
+ return chars_avail;
+}
+
int
_rl_input_queued (int t)
{
/* */
/* **************************************************************** */
-/* 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.
_rl_iscxt = cxt; /* save globally */
+ /* experimental right now */
+ _rl_init_executing_keyseq ();
+
return cxt;
}
else
cxt->sline_index = strlen (rl_line_buffer);
rl_mark = cxt->save_mark;
+ rl_deactivate_mark ();
}
rl_point = cxt->sline_index;
/* Don't worry about where to put the mark here; rl_get_previous_history
- and rl_get_next_history take care of it. */
+ and rl_get_next_history take care of it.
+ If we want to highlight the search string, this is where to set the
+ point and mark to do it. */
_rl_fix_point (0);
+ rl_deactivate_mark ();
/* _rl_optimize_redisplay (); */
rl_clear_message ();
return -1;
}
+ _rl_add_executing_keyseq (c);
+
+ /* XXX - experimental code to allow users to bracketed-paste into the search
+ string even when ESC is one of the isearch-terminators. Not perfect yet. */
+ if (_rl_enable_bracketed_paste && c == ESC && strchr (cxt->search_terminators, c) && (n = _rl_nchars_available ()) > (2*BRACK_PASTE_SLEN-1))
+ {
+ j = _rl_read_bracketed_paste_prefix (c);
+ if (j == 1)
+ {
+ cxt->lastc = -7; /* bracketed paste, see below */
+ goto opcode_dispatch;
+ }
+ else if (_rl_pushed_input_available ()) /* eat extra char we pushed back */
+ c = cxt->lastc = rl_read_key ();
+ else
+ c = cxt->lastc; /* last ditch */
+ }
+
/* If we are moving into a new keymap, modify cxt->keymap and go on.
This can be a problem if c == ESC and we want to terminate the
incremental search, so we check */
if (cxt->mb[1])
f = rl_function_of_keyseq (cxt->mb, cxt->keymap, (int *)NULL);
else
- f = cxt->keymap[c].function;
+ {
+ f = cxt->keymap[c].function;
+ if (f == rl_do_lowercase_version)
+ f = cxt->keymap[_rl_to_lower (c)].function;
+ }
if (f == rl_reverse_search_history)
cxt->lastc = (cxt->sflags & SF_REVERSE) ? -1 : -2;
}
else if (cxt->lastc > 0 && cxt->prevc > 0 && f && f != rl_insert)
{
- rl_stuff_char (cxt->lastc);
- rl_execute_next (cxt->prevc);
- /* XXX - do we insert everything in cxt->pmb? */
+ _rl_term_executing_keyseq (); /* should this go in the caller? */
+
+ _rl_pending_command.map = cxt->keymap;
+ _rl_pending_command.count = 1; /* XXX */
+ _rl_pending_command.key = cxt->lastc;
+ _rl_pending_command.func = f;
+ _rl_command_to_execute = &_rl_pending_command;
+
return (0);
}
}
return (0);
}
+ _rl_init_executing_keyseq ();
+
+opcode_dispatch:
/* Now dispatch on the character. `Opcodes' affect the search string or
state. Other characters are added to the string. */
switch (cxt->lastc)
rl_display_search (cxt->search_string, cxt->sflags, -1);
break;
}
+ /* XXX - restore keymap here? */
return (1);
}
else if ((cxt->sflags & SF_REVERSE) && cxt->sline_index >= 0)
rl_replace_line (cxt->lines[cxt->save_line], 0);
rl_point = cxt->save_point;
rl_mark = cxt->save_mark;
+ rl_deactivate_mark ();
rl_restore_prompt();
rl_clear_message ();
free (paste);
break;
}
+ rl_activate_mark ();
if (cxt->search_string_index + pastelen + 1 >= cxt->search_string_size)
{
cxt->search_string_size += pastelen + 2;
cxt->sline_index = (cxt->sflags & SF_REVERSE) ? cxt->sline_len - cxt->search_string_index : 0;
}
+ /* reset the keymaps for the next time through the loop */
+ cxt->keymap = cxt->okeymap = _rl_keymap;
+
if (cxt->sflags & SF_FAILED)
{
/* We cannot find the search string. Ding the bell. */
rl_ding ();
cxt->history_pos = cxt->last_found_line;
+ rl_deactivate_mark ();
rl_display_search (cxt->search_string, cxt->sflags, (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos);
return 1;
}
{
cxt->prev_line_found = cxt->lines[cxt->history_pos];
rl_replace_line (cxt->lines[cxt->history_pos], 0);
+ rl_activate_mark ();
rl_point = cxt->sline_index;
+ if (rl_mark_active_p () && cxt->search_string_index > 0)
+ rl_mark = rl_point + cxt->search_string_index;
cxt->last_found_line = cxt->history_pos;
rl_display_search (cxt->search_string, cxt->sflags, (cxt->history_pos == cxt->save_line) ? -1 : cxt->history_pos);
}
/* kill.c -- kill ring management. */
-/* Copyright (C) 1994-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1994-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.
/* Having read the special escape sequence denoting the beginning of a
`bracketed paste' sequence, read the rest of the pasted input until the
closing sequence and insert the pasted text as a single unit without
- interpretation. */
+ interpretation. Temporarily highlight the inserted text. */
int
rl_bracketed_paste_begin (int count, int key)
{
char *buf;
buf = _rl_bracketed_text (&len);
+ rl_mark = rl_point;
retval = rl_insert_text (buf) == len ? 0 : 1;
+ rl_activate_mark ();
xfree (buf);
return (retval);
/* mbutil.c -- readline multibyte character utility functions */
-/* Copyright (C) 2001-2017 Free Software Foundation, Inc.
+/* Copyright (C) 2001-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.
static int
_rl_utf8_mblen (const char *s, size_t n)
{
- unsigned char c, c1;
+ unsigned char c, c1, c2, c3;
if (s == 0)
return (0); /* no shift states */
c1 = (unsigned char)s[1];
if (c < 0xe0)
{
- if (n >= 2 && (s[1] ^ 0x80) < 0x40)
+ if (n == 1)
+ return -2;
+ if (n >= 2 && (c1 ^ 0x80) < 0x40)
return 2;
}
else if (c < 0xf0)
{
- if (n >= 3
- && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
+ if (n == 1)
+ return -2;
+ if ((c1 ^ 0x80) < 0x40
&& (c >= 0xe1 || c1 >= 0xa0)
&& (c != 0xed || c1 < 0xa0))
- return 3;
+ {
+ if (n == 2)
+ return -2;
+ c2 = (unsigned char)s[2];
+ if ((c2 ^ 0x80) < 0x40)
+ return 3;
+ }
}
- else if (c < 0xf8)
+ else if (c < 0xf4)
{
- if (n >= 4
- && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40
- && (s[3] ^ 0x80) < 0x40
+ if (n == 1)
+ return -2;
+ if (((c1 ^ 0x80) < 0x40)
&& (c >= 0xf1 || c1 >= 0x90)
&& (c < 0xf4 || (c == 0xf4 && c1 < 0x90)))
- return 4;
+ {
+ if (n == 2)
+ return -2;
+ c2 = (unsigned char)s[2];
+ if ((c2 ^ 0x80) < 0x40)
+ {
+ if (n == 3)
+ return -2;
+ c3 = (unsigned char)s[3];
+ if ((c3 ^ 0x80) < 0x40)
+ return 4;
+ }
+ }
}
}
/* invalid or incomplete multibyte character */
return point;
}
+static inline int
+_rl_test_nonzero (char *string, int ind, int len)
+{
+ size_t tmp;
+ wchar_t wc;
+ mbstate_t ps;
+
+ memset (&ps, 0, sizeof (mbstate_t));
+ tmp = mbrtowc (&wc, string + ind, len - ind, &ps);
+ /* treat invalid multibyte sequences as non-zero-width */
+ return (MB_INVALIDCH (tmp) || MB_NULLWCH (tmp) || WCWIDTH (wc) > 0);
+}
+
+/* experimental -- needs to handle zero-width characters better */
+static int
+_rl_find_prev_utf8char (char *string, int seed, int find_non_zero)
+{
+ char *s;
+ unsigned char b;
+ int save, prev;
+ size_t len;
+
+ if (find_non_zero)
+ len = RL_STRLEN (string);
+
+ prev = seed - 1;
+ while (prev >= 0)
+ {
+ b = (unsigned char)string[prev];
+ if (UTF8_SINGLEBYTE (b))
+ return (prev);
+
+ save = prev;
+
+ /* Move back until we're not in the middle of a multibyte char */
+ if (UTF8_MBCHAR (b))
+ {
+ while (prev > 0 && (b = (unsigned char)string[--prev]) && UTF8_MBCHAR (b))
+ ;
+ }
+
+ if (UTF8_MBFIRSTCHAR (b))
+ {
+ if (find_non_zero)
+ {
+ if (_rl_test_nonzero (string, prev, len))
+ return (prev);
+ else /* valid but WCWIDTH (wc) == 0 */
+ prev = prev - 1;
+ }
+ else
+ return (prev);
+ }
+ else
+ return (save); /* invalid utf-8 multibyte sequence */
+ }
+
+ return ((prev < 0) ? 0 : prev);
+}
+
/*static*/ int
_rl_find_prev_mbchar_internal (char *string, int seed, int find_non_zero)
{
size_t tmp;
wchar_t wc;
+ if (_rl_utf8locale)
+ return (_rl_find_prev_utf8char (string, seed, find_non_zero));
+
memset(&ps, 0, sizeof(mbstate_t));
length = strlen(string);
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 */
# Do not edit -- exists only for use by patch
-0
+4
#include "xmalloc.h"
#ifndef RL_LIBRARY_VERSION
-# define RL_LIBRARY_VERSION "5.1"
+# define RL_LIBRARY_VERSION "8.0"
#endif
#ifndef RL_READLINE_VERSION
-# define RL_READLINE_VERSION 0x0501
+# define RL_READLINE_VERSION 0x0800
#endif
extern void _rl_free_history_entry PARAMS((HIST_ENTRY *));
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. */
char *rl_executing_keyseq = 0;
int _rl_executing_keyseq_size = 0;
+struct _rl_cmd _rl_pending_command;
+struct _rl_cmd *_rl_command_to_execute = (struct _rl_cmd *)NULL;
+
/* Timeout (specified in milliseconds) when reading characters making up an
ambiguous multiple-key sequence */
int _rl_keyseq_timeout = 500;
/* Non-zero means to attempt to put the terminal in `bracketed paste mode',
where it will prefix pasted text with an escape sequence and send
another to mark the end of the paste. */
-int _rl_enable_bracketed_paste = 0;
+int _rl_enable_bracketed_paste = 1; /* XXX - for now */
/* **************************************************************** */
/* */
if (rl_startup_hook)
(*rl_startup_hook) ();
+ if (_rl_internal_startup_hook)
+ (*_rl_internal_startup_hook) ();
+
+ rl_deactivate_mark ();
+
#if defined (VI_MODE)
if (rl_editing_mode == vi_mode)
rl_vi_insertion_mode (1, 'i'); /* don't want to reset last */
r = _rl_dispatch ((unsigned char)c, _rl_keymap);
RL_CHECK_SIGNALS ();
+ if (_rl_command_to_execute)
+ {
+ (*rl_redisplay_function) ();
+
+ rl_executing_keymap = _rl_command_to_execute->map;
+ rl_executing_key = _rl_command_to_execute->key;
+
+ rl_dispatching = 1;
+ RL_SETSTATE(RL_STATE_DISPATCHING);
+ r = (*(_rl_command_to_execute->func)) (_rl_command_to_execute->count, _rl_command_to_execute->key);
+ _rl_command_to_execute = 0;
+ RL_UNSETSTATE(RL_STATE_DISPATCHING);
+ rl_dispatching = 0;
+
+ RL_CHECK_SIGNALS ();
+ }
+
/* If there was no change in _rl_last_command_was_kill, then no kill
has taken place. Note that if input is pending we are reading
a prefix command, so nothing has changed yet. */
if (rl_pending_input == 0 && lk == _rl_last_command_was_kill)
_rl_last_command_was_kill = 0;
+ if (_rl_keep_mark_active)
+ _rl_keep_mark_active = 0;
+ else if (rl_mark_active_p ())
+ rl_deactivate_mark ();
+
_rl_internal_char_cleanup ();
#if defined (READLINE_CALLBACKS)
rl_executing_keyseq = malloc (_rl_executing_keyseq_size = 16);
if (rl_executing_keyseq)
- rl_executing_keyseq[0] = '\0';
+ rl_executing_keyseq[rl_key_sequence_length = 0] = '\0';
}
/* If this system allows us to look at the values of the regular
_rl_keymap = emacs_standard_keymap;
rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_bracketed_paste_begin);
-
+
+#if defined (VI_MODE)
_rl_keymap = vi_insertion_keymap;
rl_bind_keyseq_if_unbound (BRACK_PASTE_PREF, rl_bracketed_paste_begin);
+ /* XXX - is there a reason to do this in the vi command keymap? */
+#endif
_rl_keymap = xkeymap;
}
rl_attempted_completion_function = sp->attemptfunc;
rl_completer_word_break_characters = sp->wordbreakchars;
+ rl_deactivate_mark ();
+
return (0);
}
+
+/* Functions to manage the string that is the current key sequence. */
+
+void
+_rl_init_executing_keyseq (void)
+{
+ rl_executing_keyseq[rl_key_sequence_length = 0] = '\0';
+}
+
+void
+_rl_term_executing_keyseq (void)
+{
+ rl_executing_keyseq[rl_key_sequence_length] = '\0';
+}
+
+void
+_rl_end_executing_keyseq (void)
+{
+ if (rl_key_sequence_length > 0)
+ rl_executing_keyseq[--rl_key_sequence_length] = '\0';
+}
+
+void
+_rl_add_executing_keyseq (int key)
+{
+ RESIZE_KEYSEQ_BUFFER ();
+ rl_executing_keyseq[rl_key_sequence_length++] = key;
+}
/* Readline.h -- the names of functions callable from within readline. */
-/* Copyright (C) 1987-2016 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.
extern int rl_backward_word PARAMS((int, int));
extern int rl_refresh_line PARAMS((int, int));
extern int rl_clear_screen PARAMS((int, int));
+extern int rl_clear_display PARAMS((int, int));
extern int rl_skip_csi_sequence PARAMS((int, int));
extern int rl_arrow_keys 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));
extern int rl_reset_line_state PARAMS((void));
extern int rl_crlf PARAMS((void));
+/* Functions to manage the mark and region, especially the notion of an
+ active mark and an active region. */
+extern void rl_keep_mark_active PARAMS((void));
+
+extern void rl_activate_mark PARAMS((void));
+extern void rl_deactivate_mark PARAMS((void));
+extern int rl_mark_active_p PARAMS((void));
+
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
#else
/* rlprivate.h -- functions and variables global to the readline library,
but not intended for use by applications. */
-/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1999-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.
char *search_terminators;
} _rl_search_cxt;
+struct _rl_cmd {
+ Keymap map;
+ int count;
+ int key;
+ rl_command_func_t *func;
+};
+extern struct _rl_cmd _rl_pending_command;
+extern struct _rl_cmd *_rl_command_to_execute;
+
/* Callback data for reading numeric arguments */
#define NUM_SAWMINUS 0x01
#define NUM_SAWDIGITS 0x02
/* display.c */
extern char *_rl_strip_prompt PARAMS((char *));
extern void _rl_reset_prompt PARAMS((void));
-extern void _rl_move_cursor_relative PARAMS((int, const char *));
extern void _rl_move_vert PARAMS((int));
extern void _rl_save_prompt PARAMS((void));
extern void _rl_restore_prompt PARAMS((void));
extern char *_rl_make_prompt_for_search PARAMS((int));
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_clear_screen PARAMS((int));
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));
extern int _rl_current_display_line PARAMS((void));
+extern void _rl_refresh_line PARAMS((void));
/* input.c */
extern int _rl_any_typein PARAMS((void));
extern int _rl_input_available PARAMS((void));
+extern int _rl_nchars_available PARAMS((void));
extern int _rl_input_queued PARAMS((int));
extern void _rl_insert_typein PARAMS((int));
extern int _rl_unget_char PARAMS((int));
extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
extern void _rl_internal_char_cleanup PARAMS((void));
+extern void _rl_init_executing_keyseq PARAMS((void));
+extern void _rl_term_executing_keyseq PARAMS((void));
+extern void _rl_end_executing_keyseq PARAMS((void));
+extern void _rl_add_executing_keyseq PARAMS((int));
+
/* rltty.c */
extern int _rl_disable_tty_signals PARAMS((void));
extern int _rl_restore_tty_signals PARAMS((void));
#else
extern int _rl_output_character_function PARAMS((int));
#endif
+extern void _rl_cr PARAMS((void));
extern void _rl_output_some_chars PARAMS((const char *, int));
extern int _rl_backspace PARAMS((int));
extern void _rl_enable_meta_key PARAMS((void));
extern void _rl_disable_meta_key PARAMS((void));
extern void _rl_control_keypad PARAMS((int));
extern void _rl_set_cursor PARAMS((int, int));
+extern void _rl_standout_on PARAMS((void));
+extern void _rl_standout_off PARAMS((void));
/* text.c */
extern void _rl_fix_point PARAMS((int));
extern int _rl_executing_keyseq_size;
+extern rl_hook_func_t *_rl_internal_startup_hook;
+
/* search.c */
extern _rl_search_cxt *_rl_nscxt;
/* text.c */
extern int _rl_optimize_typeahead;
+extern int _rl_keep_mark_active;
/* undo.c */
extern int _rl_doing_an_undo;
/* search.c - code for non-incremental searching in emacs and vi modes. */
-/* Copyright (C) 1992-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1992-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.
static int
noninc_dosearch (char *string, int dir, int flags)
{
- int oldpos, pos;
+ int oldpos, pos, ind;
HIST_ENTRY *entry;
if (string == 0 || *string == '\0' || noninc_history_pos < 0)
return 0;
}
- pos = noninc_search_from_pos (string, noninc_history_pos + dir, dir, flags, (int *)0);
+ pos = noninc_search_from_pos (string, noninc_history_pos + dir, dir, flags, &ind);
if (pos == -1)
{
/* Search failed, current history position unchanged. */
make_history_line_current (entry);
- rl_point = 0;
- rl_mark = rl_end;
+ if (_rl_enable_bracketed_paste && ((flags & SF_PATTERN) == 0) && ind > 0 && ind < rl_end)
+ {
+ rl_point = ind;
+ rl_mark = ind + strlen (string);
+ if (rl_mark > rl_end)
+ rl_mark = rl_end; /* can't happen? */
+ rl_activate_mark ();
+ }
+ else
+ {
+ rl_point = 0;
+ rl_mark = rl_end;
+ }
rl_clear_message ();
return 1;
static int
_rl_nsearch_dispatch (_rl_search_cxt *cxt, int c)
{
+ int n;
+
if (c < 0)
c = CTRL ('C');
_rl_nsearch_abort (cxt);
return -1;
+ case ESC:
+ /* XXX - experimental code to allow users to bracketed-paste into the
+ search string. Similar code is in isearch.c:_rl_isearch_dispatch().
+ The difference here is that the bracketed paste sometimes doesn't
+ paste everything, so checking for the prefix and the suffix in the
+ input queue doesn't work well. We just have to check to see if the
+ number of chars in the input queue is enough for the bracketed paste
+ prefix and hope for the best. */
+ if (_rl_enable_bracketed_paste && ((n = _rl_nchars_available ()) >= (BRACK_PASTE_SLEN-1)))
+ {
+ if (_rl_read_bracketed_paste_prefix (c) == 1)
+ rl_bracketed_paste_begin (1, c);
+ else
+ {
+ c = rl_read_key (); /* get the ESC that got pushed back */
+ _rl_insert_char (1, c);
+ }
+ }
+ else
+ _rl_insert_char (1, c);
+ break;
+
default:
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
}
(*rl_redisplay_function) ();
+ rl_deactivate_mark ();
return 1;
}
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2018 Free Software Foundation, Inc.
+# Copyright 1992-2020 Free Software Foundation, Inc.
-timestamp='2018-08-29'
+timestamp='2020-04-26'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2018 Free Software Foundation, Inc.
+Copyright 1992-2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
tmp=
# shellcheck disable=SC2172
-trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15
-trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
set_cc_for_build() {
+ # prevent multiple calls if $tmp is already set
+ test "$tmp" && return 0
: "${TMPDIR=/tmp}"
# shellcheck disable=SC2039
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
*:SolidBSD:*:*)
echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
exit ;;
+ *:OS108:*:*)
+ echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
+ exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
exit ;;
*:Sortix:*:*)
echo "$UNAME_MACHINE"-unknown-sortix
exit ;;
+ *:Twizzler:*:*)
+ echo "$UNAME_MACHINE"-unknown-twizzler
+ exit ;;
*:Redox:*:*)
echo "$UNAME_MACHINE"-unknown-redox
exit ;;
mips:OSF1:*.*)
- echo mips-dec-osf1
- exit ;;
+ echo mips-dec-osf1
+ exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
echo i386-pc-auroraux"$UNAME_RELEASE"
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
- case `isainfo -b` in
- 32)
- echo i386-pc-solaris2"$UNAME_REL"
- ;;
- 64)
- echo x86_64-pc-solaris2"$UNAME_REL"
- ;;
- esac
+ set_cc_for_build
+ SUN_ARCH=i386
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH=x86_64
+ fi
+ fi
+ echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
set_cc_for_build
+ IS_GLIBC=0
+ test x"${LIBC}" = xgnu && IS_GLIBC=1
sed 's/^ //' << EOF > "$dummy.c"
#undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
+ #undef mips
+ #undef mipsel
+ #undef mips64
+ #undef mips64el
+ #if ${IS_GLIBC} && defined(_ABI64)
+ LIBCABI=gnuabi64
+ #else
+ #if ${IS_GLIBC} && defined(_ABIN32)
+ LIBCABI=gnuabin32
+ #else
+ LIBCABI=${LIBC}
+ #endif
+ #endif
+
+ #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa64r6
+ #else
+ #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
+ CPU=mipsisa32r6
+ #else
+ #if defined(__mips64)
+ CPU=mips64
+ #else
+ CPU=mips
+ #endif
+ #endif
+ #endif
+
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
+ MIPS_ENDIAN=el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
+ MIPS_ENDIAN=
#else
- CPU=
+ MIPS_ENDIAN=
#endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
- test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
+ eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
+ test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
;;
mips64el:Linux:*:*)
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
- echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
+ echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
exit ;;
*:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
+ UNAME_PROCESSOR=`uname -p`
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ if command -v xcode-select > /dev/null 2> /dev/null && \
+ ! xcode-select --print-path > /dev/null 2> /dev/null ; then
+ # Avoid executing cc if there is no toolchain installed as
+ # cc will be a stub that puts up a graphical alert
+ # prompting the user to install developer tools.
+ CC_FOR_BUILD=no_compiler_found
+ else
+ set_cc_for_build
fi
- if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
- if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_PPC >/dev/null
- then
- UNAME_PROCESSOR=powerpc
- fi
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
+ # uname -m returns i386 or x86_64
+ UNAME_PROCESSOR=$UNAME_MACHINE
fi
echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
exit ;;
amd64:Isilon\ OneFS:*:*)
echo x86_64-unknown-onefs
exit ;;
+ *:Unleashed:*:*)
+ echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
+ exit ;;
esac
+# No uname command or uname output not recognized.
+set_cc_for_build
+cat > "$dummy.c" <<EOF
+#ifdef _SEQUENT_
+#include <sys/types.h>
+#include <sys/utsname.h>
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) || defined(SIGLOST)
+#include <sys/utsname.h>
+#endif
+#endif
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+#include <sys/param.h>
+#if defined (BSD)
+#if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+#else
+#if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#endif
+#else
+ printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#else
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname un;
+ uname (&un);
+ printf ("vax-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
+#if defined(_SIZE_T_) || defined(SIGLOST)
+ struct utsname *un;
+ uname (&un);
+ printf ("mips-dec-ultrix%s\n", un.release); exit (0);
+#else
+ printf ("mips-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
+
echo "$0: unable to guess system type" >&2
case "$UNAME_MACHINE:$UNAME_SYSTEM" in
https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+EOF
+
+year=`echo $timestamp | sed 's,-.*,,'`
+# shellcheck disable=SC2003
+if test "`expr "\`date +%Y\`" - "$year"`" -lt 3 ; then
+ cat >&2 <<EOF
If $0 has already been updated, send the following data and any
information you think might be pertinent to config-patches@gnu.org to
UNAME_SYSTEM = "$UNAME_SYSTEM"
UNAME_VERSION = "$UNAME_VERSION"
EOF
+fi
exit 1
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2018 Free Software Foundation, Inc.
+# Copyright 1992-2020 Free Software Foundation, Inc.
-timestamp='2018-08-29'
+timestamp='2020-05-04'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2018 Free Software Foundation, Inc.
+Copyright 1992-2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
esac
# Split fields of configuration type
-IFS="-" read -r field1 field2 field3 field4 <<EOF
+# shellcheck disable=SC2162
+IFS="-" read field1 field2 field3 field4 <<EOF
$1
EOF
basic_machine=m88k-harris
os=sysv3
;;
- hp300)
+ hp300 | hp300hpux)
basic_machine=m68k-hp
+ os=hpux
;;
hp300bsd)
basic_machine=m68k-hp
os=bsd
;;
- hp300hpux)
- basic_machine=m68k-hp
- os=hpux
- ;;
hppaosf)
basic_machine=hppa1.1-hp
os=osf
basic_machine=i386-mach
os=mach
;;
- vsta)
- basic_machine=i386-pc
- os=vsta
- ;;
isi68 | isi)
basic_machine=m68k-isi
os=sysv
basic_machine=vax-dec
os=vms
;;
+ vsta)
+ basic_machine=i386-pc
+ os=vsta
+ ;;
vxworks960)
basic_machine=i960-wrs
os=vxworks
cpu=m68k
vendor=next
case $os in
- nextstep* )
+ openstep*)
+ ;;
+ nextstep*)
;;
ns2*)
os=nextstep2
;;
*-*)
- IFS="-" read -r cpu vendor <<EOF
+ # shellcheck disable=SC2162
+ IFS="-" read cpu vendor <<EOF
$basic_machine
EOF
;;
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
| alphapca5[67] | alpha64pca5[67] \
| am33_2.0 \
+ | amdgcn \
| arc | arceb \
| arm | arm[lb]e | arme[lb] | armv* \
| avr | avr32 \
| asmjs \
| ba \
| be32 | be64 \
- | bfin | bs2000 \
+ | bfin | bpf | bs2000 \
| c[123]* | c30 | [cjt]90 | c4x \
| c8051 | clipper | craynv | csky | cydra \
| d10v | d30v | dlx | dsp16xx \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle \
- | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k | v70 | w65 \
- | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip \
+ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
+ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
| m88110 | m88k | maxq | mb | mcore | mep | metag \
| microblaze | microblazeel \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
- | mips64 | mips64el \
+ | mips64 | mips64eb | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| nds32 | nds32le | nds32be \
| nfp \
| nios | nios2 | nios2eb | nios2el \
- | none | np1 | ns16k | ns32k \
+ | none | np1 | ns16k | ns32k | nvptx \
| open8 \
| or1k* \
| or32 \
| orion \
+ | picochip \
| pdp10 | pdp11 | pj | pjl | pn | power \
| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
| pru \
| riscv | riscv32 | riscv64 \
| rl78 | romp | rs6000 | rx \
| score \
- | sh | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
+ | sh | shl \
+ | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \
| sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \
| sparclite \
| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
| tron \
| ubicom32 \
- | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+ | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
| vax \
| visium \
- | wasm32 \
+ | w65 \
+ | wasm32 | wasm64 \
| we32k \
| x86 | x86_64 | xc16x | xgate | xps100 \
| xstormy16 | xtensa* \
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| sym* | kopensolaris* | plan9* \
| amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
- | aos* | aros* | cloudabi* | sortix* \
+ | aos* | aros* | cloudabi* | sortix* | twizzler* \
| nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
| clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
| knetbsd* | mirbsd* | netbsd* \
- | bitrig* | openbsd* | solidbsd* | libertybsd* \
+ | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \
| ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \
| bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
| ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
| powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
- | midnightbsd*)
+ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
+ | nsk* | powerunix* | genode*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
qnx*)
ns2)
os=nextstep2
;;
- nsk*)
- os=nsk
- ;;
# Preserve the version number of sinix5.
sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
static char *_rl_term_mm;
static char *_rl_term_mo;
+/* The sequences to enter and exit standout mode. */
+static char *_rl_term_so;
+static char *_rl_term_se;
+
/* The key sequences output by the arrow keys, if this terminal has any. */
static char *_rl_term_ku;
static char *_rl_term_kd;
{ "mo", &_rl_term_mo },
{ "nd", &_rl_term_forward_char },
{ "pc", &_rl_term_pc },
+ { "se", &_rl_term_se },
+ { "so", &_rl_term_so },
{ "up", &_rl_term_up },
{ "vb", &_rl_visible_bell },
{ "vs", &_rl_term_vs },
_rl_term_goto = _rl_term_pc = _rl_term_ip = (char *)NULL;
_rl_term_ks = _rl_term_ke =_rl_term_vs = _rl_term_ve = (char *)NULL;
_rl_term_kh = _rl_term_kH = _rl_term_at7 = _rl_term_kI = (char *)NULL;
+ _rl_term_so = _rl_term_se = (char *)NULL;
#if defined(HACK_TERMCAP_MOTION)
_rl_term_forward_char = (char *)NULL;
#endif
_rl_term_mm = _rl_term_mo = (char *)NULL;
_rl_term_ve = _rl_term_vs = (char *)NULL;
_rl_term_forward_char = (char *)NULL;
+ _rl_term_so = _rl_term_se = (char *)NULL;
_rl_terminal_can_insert = term_has_meta = 0;
/* Reasonable defaults for tgoto(). Readline currently only uses
BC = _rl_term_backspace;
UP = _rl_term_up;
- if (!_rl_term_cr)
+ if (_rl_term_cr == 0)
_rl_term_cr = "\r";
_rl_term_autowrap = TGETFLAG ("am") && TGETFLAG ("xn");
return 0;
}
+void
+_rl_cr (void)
+{
+#if defined (__MSDOS__)
+ putc ('\r', rl_outstream);
+#else
+ tputs (_rl_term_cr, 1, _rl_output_character_function);
+#endif
+}
+
/* Ring the terminal bell. */
int
rl_ding (void)
return (-1);
}
+/* **************************************************************** */
+/* */
+/* Entering and leaving terminal standout mode */
+/* */
+/* **************************************************************** */
+
+void
+_rl_standout_on (void)
+{
+#ifndef __MSDOS__
+ if (_rl_term_so && _rl_term_se)
+ tputs (_rl_term_so, 1, _rl_output_character_function);
+#endif
+}
+
+void
+_rl_standout_off (void)
+{
+#ifndef __MSDOS__
+ if (_rl_term_so && _rl_term_se)
+ tputs (_rl_term_se, 1, _rl_output_character_function);
+#endif
+}
+
/* **************************************************************** */
/* */
/* Controlling the Meta Key and Keypad */
/* text.c -- text handling commands for readline. */
-/* 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.
int
rl_refresh_line (int ignore1, int ignore2)
{
- int curr_line;
-
- curr_line = _rl_current_display_line ();
-
- _rl_move_vert (curr_line);
- _rl_move_cursor_relative (0, rl_line_buffer); /* XXX is this right */
-
- _rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
-
- rl_redraw_prompt_last_line ();
+ _rl_refresh_line ();
rl_display_fixed = 1;
-
return 0;
}
return 0;
}
- _rl_clear_screen (); /* calls termcap function to clear screen */
+ _rl_clear_screen (0); /* calls termcap function to clear screen */
+ rl_keep_mark_active ();
+ rl_forced_update_display ();
+ rl_display_fixed = 1;
+
+ return 0;
+}
+
+int
+rl_clear_display (int count, int key)
+{
+ _rl_clear_screen (1); /* calls termcap function to clear screen and scrollback buffer */
rl_forced_update_display ();
rl_display_fixed = 1;
int
rl_newline (int count, int key)
{
+ if (rl_mark_active_p ())
+ {
+ rl_deactivate_mark ();
+ (*rl_redisplay_function) ();
+ _rl_want_redisplay = 0;
+ }
+
rl_done = 1;
if (_rl_history_preserve_point)
return 1;
}
else
- SWAP (rl_point, rl_mark);
+ {
+ SWAP (rl_point, rl_mark);
+ rl_activate_mark ();
+ }
return 0;
}
+
+/* Active mark support */
+
+/* Is the region active? */
+static int mark_active = 0;
+
+/* Does the current command want the mark to remain active when it completes? */
+int _rl_keep_mark_active;
+
+void
+rl_keep_mark_active (void)
+{
+ _rl_keep_mark_active++;
+}
+
+void
+rl_activate_mark (void)
+{
+ mark_active = 1;
+ rl_keep_mark_active ();
+}
+
+void
+rl_deactivate_mark (void)
+{
+ mark_active = 0;
+}
+
+int
+rl_mark_active_p (void)
+{
+ return (mark_active);
+}
rl_clear_message ();
_rl_reset_argument ();
rl_clear_pending_input ();
+ rl_deactivate_mark ();
while (rl_executing_macro)
_rl_pop_executing_macro ();