mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-06 20:00:49 +02:00
bash-4.4 beta2 release
This commit is contained in:
+18
-6
@@ -119,9 +119,6 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
break;
|
||||
|
||||
case '*': /* Match zero or more characters */
|
||||
if (p == pe)
|
||||
return 0;
|
||||
|
||||
if ((flags & FNM_PERIOD) && sc == L('.') &&
|
||||
(n == string || ((flags & FNM_PATHNAME) && n[-1] == L('/'))))
|
||||
/* `*' cannot match a `.' if it is the first character of the
|
||||
@@ -129,6 +126,9 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
we are matching a pathname. */
|
||||
return FNM_NOMATCH;
|
||||
|
||||
if (p == pe)
|
||||
return 0;
|
||||
|
||||
/* Collapse multiple consecutive `*' and `?', but make sure that
|
||||
one character of the string is consumed for each `?'. */
|
||||
for (c = *p++; (c == L('?') || c == L('*')); c = *p++)
|
||||
@@ -140,14 +140,26 @@ fprintf(stderr, "gmatch: pattern = %s; pe = %s\n", pattern, pe);
|
||||
else if ((flags & FNM_EXTMATCH) && c == L('?') && *p == L('(')) /* ) */
|
||||
{
|
||||
CHAR *newn;
|
||||
|
||||
#if 0
|
||||
for (newn = n; newn < se; ++newn)
|
||||
{
|
||||
if (EXTMATCH (c, newn, se, p, pe, flags) == 0)
|
||||
return (0);
|
||||
}
|
||||
/* We didn't match. If we have a `?(...)', we can match 0
|
||||
or 1 times. */
|
||||
return 0;
|
||||
#else
|
||||
/* We can match 0 or 1 times. If we match, return success */
|
||||
if (EXTMATCH (c, n, se, p, pe, flags) == 0)
|
||||
return (0);
|
||||
#endif
|
||||
|
||||
/* We didn't match the extended glob pattern, but
|
||||
that's OK, since we can match 0 or 1 occurrences.
|
||||
We need to skip the glob pattern and see if we
|
||||
match the rest of the string. */
|
||||
newn = PATSCAN (p + 1, pe, 0);
|
||||
/* If NEWN is 0, we have an ill-formed pattern. */
|
||||
p = newn ? newn : pe;
|
||||
}
|
||||
#endif
|
||||
else if (c == L('?'))
|
||||
|
||||
+21
-8
@@ -214,7 +214,7 @@ int _rl_colored_stats = 0;
|
||||
|
||||
/* Non-zero means to use a color (currently magenta) to indicate the common
|
||||
prefix of a set of possible word completions. */
|
||||
int _rl_colored_completion_prefix = 1;
|
||||
int _rl_colored_completion_prefix = 0;
|
||||
#endif
|
||||
|
||||
/* If non-zero, when completing in the middle of a word, don't insert
|
||||
@@ -807,7 +807,7 @@ fnprint (to_print, prefix_bytes, real_pathname)
|
||||
{
|
||||
int printed_len, w;
|
||||
const char *s;
|
||||
int common_prefix_len;
|
||||
int common_prefix_len, print_len;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t ps;
|
||||
const char *end;
|
||||
@@ -815,7 +815,8 @@ fnprint (to_print, prefix_bytes, real_pathname)
|
||||
int width;
|
||||
wchar_t wc;
|
||||
|
||||
end = to_print + strlen (to_print) + 1;
|
||||
print_len = strlen (to_print);
|
||||
end = to_print + print_len + 1;
|
||||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
#endif
|
||||
|
||||
@@ -825,7 +826,7 @@ fnprint (to_print, prefix_bytes, 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 && to_print[prefix_bytes] == '\0')
|
||||
if (_rl_completion_prefix_display_length > 0 && prefix_bytes >= print_len)
|
||||
prefix_bytes = 0;
|
||||
|
||||
#if defined (COLOR_SUPPORT)
|
||||
@@ -1571,9 +1572,12 @@ rl_display_match_list (matches, len, max)
|
||||
if (_rl_completion_prefix_display_length > 0)
|
||||
{
|
||||
t = printable_part (matches[0]);
|
||||
temp = strrchr (t, '/'); /* check again in case of /usr/src/ */
|
||||
/* 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);
|
||||
if (common_length > max || sind > max)
|
||||
common_length = sind = 0;
|
||||
|
||||
if (common_length > _rl_completion_prefix_display_length && common_length > ELLIPSIS_LEN)
|
||||
max -= common_length - ELLIPSIS_LEN;
|
||||
@@ -1584,9 +1588,11 @@ rl_display_match_list (matches, len, max)
|
||||
else if (_rl_colored_completion_prefix > 0)
|
||||
{
|
||||
t = printable_part (matches[0]);
|
||||
temp = strrchr (t, '/');
|
||||
temp = rl_filename_completion_desired ? strrchr (t, '/') : 0;
|
||||
common_length = temp ? fnwidth (temp) : fnwidth (t);
|
||||
sind = temp ? RL_STRLEN (temp+1) : RL_STRLEN (t); /* want portion after final slash */
|
||||
if (common_length > max || sind > max)
|
||||
common_length = sind = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1635,8 +1641,13 @@ rl_display_match_list (matches, len, max)
|
||||
printed_len = print_filename (temp, matches[l], sind);
|
||||
|
||||
if (j + 1 < limit)
|
||||
for (k = 0; k < max - printed_len; k++)
|
||||
putc (' ', rl_outstream);
|
||||
{
|
||||
if (max <= printed_len)
|
||||
putc (' ', rl_outstream);
|
||||
else
|
||||
for (k = 0; k < max - printed_len; k++)
|
||||
putc (' ', rl_outstream);
|
||||
}
|
||||
}
|
||||
l += count;
|
||||
}
|
||||
@@ -1683,6 +1694,8 @@ rl_display_match_list (matches, len, max)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (max <= printed_len)
|
||||
putc (' ', rl_outstream);
|
||||
else
|
||||
for (k = 0; k < max - printed_len; k++)
|
||||
putc (' ', rl_outstream);
|
||||
|
||||
+61
-31
@@ -826,7 +826,7 @@ rl_redisplay ()
|
||||
lpos -= _rl_col_width (local_prompt, n0, num, 1) - wadjust;
|
||||
else
|
||||
#endif
|
||||
lpos -= _rl_screenwidth - wadjust;
|
||||
lpos -= _rl_screenwidth; /* all physical cursor positions */
|
||||
}
|
||||
|
||||
prompt_last_screen_line = newlines;
|
||||
@@ -1389,6 +1389,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
int current_invis_chars;
|
||||
int col_lendiff, col_temp;
|
||||
int bytes_to_insert;
|
||||
int mb_cur_max = MB_CUR_MAX;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
mbstate_t ps_new, ps_old;
|
||||
int new_offset, old_offset;
|
||||
@@ -1399,7 +1400,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
the exact cursor position and cut-and-paste with certain terminal
|
||||
emulators. In this calculation, TEMP is the physical screen
|
||||
position of the cursor. */
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
temp = _rl_last_c_pos;
|
||||
else
|
||||
temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
|
||||
@@ -1407,7 +1408,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
&& _rl_last_v_pos == current_line - 1)
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
wchar_t wc;
|
||||
mbstate_t ps;
|
||||
@@ -1421,7 +1422,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
_rl_clear_to_eol (line_state_visible->wrapped_line[current_line]);
|
||||
|
||||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
ret = mbrtowc (&wc, new, MB_CUR_MAX, &ps);
|
||||
ret = mbrtowc (&wc, new, mb_cur_max, &ps);
|
||||
if (MB_INVALIDCH (ret))
|
||||
{
|
||||
tempwidth = 1;
|
||||
@@ -1441,7 +1442,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
_rl_last_c_pos = tempwidth;
|
||||
_rl_last_v_pos++;
|
||||
memset (&ps, 0, sizeof (mbstate_t));
|
||||
ret = mbrtowc (&wc, old, MB_CUR_MAX, &ps);
|
||||
ret = mbrtowc (&wc, old, mb_cur_max, &ps);
|
||||
if (ret != 0 && bytes != 0)
|
||||
{
|
||||
if (MB_INVALIDCH (ret))
|
||||
@@ -1480,7 +1481,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
|
||||
/* Find first difference. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
/* See if the old line is a subset of the new line, so that the
|
||||
only change is adding characters. */
|
||||
@@ -1537,7 +1538,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
return;
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_utf8locale)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0 && _rl_utf8locale)
|
||||
{
|
||||
wchar_t wc;
|
||||
mbstate_t ps = { 0 };
|
||||
@@ -1546,7 +1547,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
/* If the first character in the difference is a zero-width character,
|
||||
assume it's a combining character and back one up so the two base
|
||||
characters no longer compare equivalently. */
|
||||
t = mbrtowc (&wc, ofd, MB_CUR_MAX, &ps);
|
||||
t = mbrtowc (&wc, ofd, mb_cur_max, &ps);
|
||||
if (t > 0 && UNICODE_COMBINING_CHAR (wc) && WCWIDTH (wc) == 0)
|
||||
{
|
||||
old_offset = _rl_find_prev_mbchar (old, ofd - old, MB_FIND_ANY);
|
||||
@@ -1560,7 +1561,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
wsatend = 1; /* flag for trailing whitespace */
|
||||
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
ols = old + _rl_find_prev_mbchar (old, oe - old, MB_FIND_ANY);
|
||||
nls = new + _rl_find_prev_mbchar (new, ne - new, MB_FIND_ANY);
|
||||
@@ -1618,14 +1619,14 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
{
|
||||
if (*ols) /* don't step past the NUL */
|
||||
{
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
ols = old + _rl_find_next_mbchar (old, ols - old, 1, MB_FIND_ANY);
|
||||
else
|
||||
ols++;
|
||||
}
|
||||
if (*nls)
|
||||
{
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
nls = new + _rl_find_next_mbchar (new, nls - new, 1, MB_FIND_ANY);
|
||||
else
|
||||
nls++;
|
||||
@@ -1642,7 +1643,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
visible_wrap_offset based on what we know. */
|
||||
if (current_line == 0)
|
||||
visible_wrap_offset = prompt_invis_chars_first_line; /* XXX */
|
||||
if ((MB_CUR_MAX == 1 || rl_byte_oriented) && current_line == 0 && visible_wrap_offset)
|
||||
if ((mb_cur_max == 1 || rl_byte_oriented) && current_line == 0 && visible_wrap_offset)
|
||||
_rl_last_c_pos += visible_wrap_offset;
|
||||
}
|
||||
|
||||
@@ -1687,7 +1688,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
if (modmark)
|
||||
_rl_output_some_chars ("*", 1);
|
||||
_rl_output_some_chars (local_prompt, lendiff);
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
/* We take wrap_offset into account here so we can pass correct
|
||||
information to _rl_move_cursor_relative. */
|
||||
@@ -1723,7 +1724,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
if (temp > 0)
|
||||
{
|
||||
_rl_output_some_chars (nfd, temp);
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
_rl_last_c_pos += _rl_col_width (new, nd, ne - new, 1);
|
||||
else
|
||||
_rl_last_c_pos += temp;
|
||||
@@ -1746,7 +1747,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
/* We need to indicate that the cursor position is correct in the presence of
|
||||
invisible characters in the prompt string. Let's see if setting this when
|
||||
we make sure we're at the end of the drawn prompt string works. */
|
||||
if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
|
||||
if (current_line == 0 && mb_cur_max > 1 && rl_byte_oriented == 0 &&
|
||||
(_rl_last_c_pos > 0 || o_cpos > 0) &&
|
||||
_rl_last_c_pos == prompt_physical_chars)
|
||||
cpos_adjusted = 1;
|
||||
@@ -1757,7 +1758,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
col_lendiff == difference on screen (columns)
|
||||
When not using multibyte characters, these are equal */
|
||||
lendiff = (nls - nfd) - (ols - ofd);
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
col_lendiff = _rl_col_width (new, nfd - new, nls - new, 1) - _rl_col_width (old, ofd - old, ols - old, 1);
|
||||
else
|
||||
col_lendiff = lendiff;
|
||||
@@ -1768,7 +1769,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
if (current_line == 0 && /* !_rl_horizontal_scroll_mode && */
|
||||
current_invis_chars != visible_wrap_offset)
|
||||
{
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
lendiff += visible_wrap_offset - current_invis_chars;
|
||||
col_lendiff += visible_wrap_offset - current_invis_chars;
|
||||
@@ -1786,7 +1787,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
and writes TEMP bytes. */
|
||||
/* Insert (diff (len (old), len (new)) ch. */
|
||||
temp = ne - nfd;
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
col_temp = _rl_col_width (new, nfd - new, ne - new, 1);
|
||||
else
|
||||
col_temp = temp;
|
||||
@@ -1837,7 +1838,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
_rl_last_c_pos == 0 &&
|
||||
lendiff > prompt_visible_length &&
|
||||
current_invis_chars > 0) == 0) &&
|
||||
(((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
|
||||
(((mb_cur_max > 1 && rl_byte_oriented == 0) &&
|
||||
current_line == 0 && wrap_offset &&
|
||||
((nfd - new) <= prompt_last_invisible) &&
|
||||
(col_lendiff < prompt_visible_length)) == 0) &&
|
||||
@@ -1845,12 +1846,12 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
{
|
||||
open_some_spaces (col_lendiff);
|
||||
_rl_output_some_chars (nfd, bytes_to_insert);
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
_rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1);
|
||||
else
|
||||
_rl_last_c_pos += bytes_to_insert;
|
||||
}
|
||||
else if ((MB_CUR_MAX == 1 || rl_byte_oriented != 0) && *ols == 0 && lendiff > 0)
|
||||
else if ((mb_cur_max == 1 || rl_byte_oriented != 0) && *ols == 0 && lendiff > 0)
|
||||
{
|
||||
/* At the end of a line the characters do not have to
|
||||
be "inserted". They can just be placed on the screen. */
|
||||
@@ -1865,7 +1866,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
/* If nfd begins before the last invisible character in the
|
||||
prompt, adjust _rl_last_c_pos to account for wrap_offset
|
||||
and set cpos_adjusted to let the caller know. */
|
||||
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
|
||||
if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
|
||||
{
|
||||
_rl_last_c_pos -= wrap_offset;
|
||||
cpos_adjusted = 1;
|
||||
@@ -1878,7 +1879,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
/* If nfd begins before the last invisible character in the
|
||||
prompt, adjust _rl_last_c_pos to account for wrap_offset
|
||||
and set cpos_adjusted to let the caller know. */
|
||||
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
|
||||
if ((mb_cur_max > 1 && rl_byte_oriented == 0) && current_line == 0 && displaying_prompt_first_line && wrap_offset && ((nfd - new) <= prompt_last_invisible))
|
||||
{
|
||||
_rl_last_c_pos -= wrap_offset;
|
||||
cpos_adjusted = 1;
|
||||
@@ -1898,7 +1899,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
crude attempt to compute how far into the new line buffer we are.
|
||||
It doesn't work well in the face of multibyte characters and needs
|
||||
to be rethought. XXX */
|
||||
if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
|
||||
if ((mb_cur_max > 1 && rl_byte_oriented == 0) &&
|
||||
current_line == prompt_last_screen_line && wrap_offset &&
|
||||
displaying_prompt_first_line &&
|
||||
wrap_offset != prompt_invis_chars_first_line &&
|
||||
@@ -1942,7 +1943,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
in a multibyte locale to account for the wrap offset and
|
||||
set cpos_adjusted accordingly. */
|
||||
_rl_output_some_chars (nfd, bytes_to_insert);
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
_rl_last_c_pos += _rl_col_width (nfd, 0, bytes_to_insert, 1);
|
||||
if (current_line == 0 && wrap_offset &&
|
||||
@@ -1977,7 +1978,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
set cpos_adjusted accordingly. */
|
||||
_rl_output_some_chars (nfd, temp);
|
||||
_rl_last_c_pos += col_temp; /* XXX */
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
if (current_line == 0 && wrap_offset &&
|
||||
displaying_prompt_first_line &&
|
||||
@@ -1991,7 +1992,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
||||
}
|
||||
clear_rest_of_line:
|
||||
lendiff = (oe - old) - (ne - new);
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
col_lendiff = _rl_col_width (old, 0, oe - old, 1) - _rl_col_width (new, 0, ne - new, 1);
|
||||
else
|
||||
col_lendiff = lendiff;
|
||||
@@ -2001,7 +2002,7 @@ clear_rest_of_line:
|
||||
space_to_eol will insert too many spaces. XXX - maybe we should
|
||||
adjust col_lendiff based on the difference between _rl_last_c_pos
|
||||
and _rl_screenwidth */
|
||||
if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
|
||||
if (col_lendiff && ((mb_cur_max == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
|
||||
{
|
||||
if (_rl_term_autowrap && current_line < inv_botlin)
|
||||
space_to_eol (col_lendiff);
|
||||
@@ -2027,6 +2028,34 @@ rl_on_new_line ()
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Clear all screen lines occupied by the current readline line buffer
|
||||
(visible line) */
|
||||
int
|
||||
rl_clear_visible_line ()
|
||||
{
|
||||
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_last_c_pos = 0;
|
||||
|
||||
/* Move to the last screen line of the current visible line */
|
||||
_rl_move_vert (_rl_vis_botlin);
|
||||
|
||||
/* And erase screen lines going up to line 0 (first visible line) */
|
||||
for (curr_line = _rl_last_v_pos; curr_line >= 0; curr_line--)
|
||||
{
|
||||
_rl_move_vert (curr_line);
|
||||
_rl_clear_to_eol (0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Tell the update routines that we have moved onto a new line with the
|
||||
prompt already displayed. Code originally from the version of readline
|
||||
distributed with CLISP. rl_expand_prompt must have already been called
|
||||
@@ -2133,6 +2162,7 @@ _rl_move_cursor_relative (new, data)
|
||||
int cpos, dpos; /* current and desired cursor positions */
|
||||
int adjust;
|
||||
int in_invisline;
|
||||
int mb_cur_max = MB_CUR_MAX;
|
||||
|
||||
woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
|
||||
cpos = _rl_last_c_pos;
|
||||
@@ -2146,7 +2176,7 @@ _rl_move_cursor_relative (new, data)
|
||||
this case, NEW's display position is not obvious and must be
|
||||
calculated. We need to account for invisible characters in this line,
|
||||
as long as we are past them and they are counted by _rl_col_width. */
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
adjust = 1;
|
||||
/* Try to short-circuit common cases and eliminate a bunch of multibyte
|
||||
@@ -2214,7 +2244,7 @@ _rl_move_cursor_relative (new, data)
|
||||
of moving backwards. */
|
||||
/* i == current physical cursor position. */
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
i = _rl_last_c_pos;
|
||||
else
|
||||
#endif
|
||||
@@ -2249,7 +2279,7 @@ _rl_move_cursor_relative (new, data)
|
||||
in the buffer and we have to go back to the beginning of the screen
|
||||
line. In this case, we can use the terminal sequence to move forward
|
||||
if it's available. */
|
||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||
if (mb_cur_max > 1 && rl_byte_oriented == 0)
|
||||
{
|
||||
if (_rl_term_forward_char)
|
||||
{
|
||||
|
||||
@@ -963,6 +963,10 @@ redisplay.
|
||||
It should be used after setting @var{rl_already_prompted}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_clear_visible_line (void)
|
||||
Clear the screen lines corresponding to the current line's contents.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_reset_line_state (void)
|
||||
Reset the display state to a clean state and redisplay the current line
|
||||
starting on a new line.
|
||||
@@ -1136,6 +1140,14 @@ that the terminal editing characters are bound to @code{rl_insert}.
|
||||
The bindings are performed in @var{kmap}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_tty_set_echoing (int value)
|
||||
Set Readline's idea of whether or not it is echoing output to its output
|
||||
stream (@var{rl_outstream}). If @var{value} is 0, Readline does not display
|
||||
output to @var{rl_outstream}; any other value enables output. The initial
|
||||
value is set when Readline initializes the terminal settings.
|
||||
This function returns the previous value.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun int rl_reset_terminal (const char *terminal_name)
|
||||
Reinitialize Readline's idea of the terminal settings using
|
||||
@var{terminal_name} as the terminal type (e.g., @code{vt100}).
|
||||
@@ -1423,12 +1435,16 @@ It understands the EOF character or "exit" to exit the program.
|
||||
@example
|
||||
/* Standard include files. stdio.h is required. */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
|
||||
/* Used for select(2) */
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Standard readline include files. */
|
||||
@@ -1436,10 +1452,20 @@ It understands the EOF character or "exit" to exit the program.
|
||||
#include <readline/history.h>
|
||||
|
||||
static void cb_linehandler (char *);
|
||||
static void sighandler (int);
|
||||
|
||||
int running;
|
||||
int sigwinch_received;
|
||||
const char *prompt = "rltest$ ";
|
||||
|
||||
/* Handle SIGWINCH and window size changes when readline is not active and
|
||||
reading a character. */
|
||||
static void
|
||||
sighandler (int sig)
|
||||
@{
|
||||
sigwinch_received = 1;
|
||||
@}
|
||||
|
||||
/* Callback function called for each line when accept-line executed, EOF
|
||||
seen, or EOF character read. This sets a flag and returns; it could
|
||||
also call exit(3). */
|
||||
@@ -1474,6 +1500,13 @@ main (int c, char **v)
|
||||
fd_set fds;
|
||||
int r;
|
||||
|
||||
/* Set the default locale values according to environment variables. */
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
/* Handle window size changes when readline is not active and reading
|
||||
characters. */
|
||||
signal (SIGWINCH, sighandler);
|
||||
|
||||
/* Install the line handler. */
|
||||
rl_callback_handler_install (prompt, cb_linehandler);
|
||||
|
||||
@@ -1488,12 +1521,19 @@ main (int c, char **v)
|
||||
FD_SET (fileno (rl_instream), &fds);
|
||||
|
||||
r = select (FD_SETSIZE, &fds, NULL, NULL, NULL);
|
||||
if (r < 0)
|
||||
if (r < 0 && errno != EINTR)
|
||||
@{
|
||||
perror ("rltest: select");
|
||||
rl_callback_handler_remove ();
|
||||
break;
|
||||
@}
|
||||
if (sigwinch_received)
|
||||
@{
|
||||
rl_resize_terminal ();
|
||||
sigwinch_received = 0;
|
||||
}@
|
||||
if (r < 0)
|
||||
continue;
|
||||
|
||||
if (FD_ISSET (fileno (rl_instream), &fds))
|
||||
rl_callback_read_char ();
|
||||
|
||||
@@ -499,7 +499,9 @@ The default limit is @code{100}.
|
||||
If set to @samp{on}, Readline will convert characters with the
|
||||
eighth bit set to an @sc{ascii} key sequence by stripping the eighth
|
||||
bit and prefixing an @key{ESC} character, converting them to a
|
||||
meta-prefixed key sequence. The default value is @samp{on}.
|
||||
meta-prefixed key sequence. The default value is @samp{on}, but
|
||||
will be set to @samp{off} if the locale is one that contains
|
||||
eight-bit characters.
|
||||
|
||||
@item disable-completion
|
||||
@vindex disable-completion
|
||||
@@ -507,6 +509,12 @@ If set to @samp{On}, Readline will inhibit word completion.
|
||||
Completion characters will be inserted into the line as if they had
|
||||
been mapped to @code{self-insert}. The default is @samp{off}.
|
||||
|
||||
@item echo-control-characters
|
||||
@vindex echo-control-characters
|
||||
When set to @samp{on}, on operating systems that indicate they support it,
|
||||
readline echoes a character corresponding to a signal generated from the
|
||||
keyboard. The default is @samp{on}.
|
||||
|
||||
@item editing-mode
|
||||
@vindex editing-mode
|
||||
The @code{editing-mode} variable controls which default set of
|
||||
@@ -525,12 +533,6 @@ non-printing characters, which can be used to embed a terminal control
|
||||
sequence into the mode string.
|
||||
The default is @samp{@@}.
|
||||
|
||||
@item echo-control-characters
|
||||
@vindex echo-control-characters
|
||||
When set to @samp{on}, on operating systems that indicate they support it,
|
||||
readline echoes a character corresponding to a signal generated from the
|
||||
keyboard. The default is @samp{on}.
|
||||
|
||||
@item enable-bracketed-paste
|
||||
@vindex enable-bracketed-paste
|
||||
When set to @samp{On}, Readline will configure the terminal in a way
|
||||
@@ -571,6 +573,8 @@ are saved.
|
||||
If set to a value less than zero, the number of history entries is not
|
||||
limited.
|
||||
By default, the number of history entries is not limited.
|
||||
If an attempt is made to set @var{history-size} to a non-numeric value,
|
||||
the maximum number of history entries will be set to 500.
|
||||
|
||||
@item horizontal-scroll-mode
|
||||
@vindex horizontal-scroll-mode
|
||||
@@ -586,8 +590,9 @@ this variable is set to @samp{off}.
|
||||
If set to @samp{on}, Readline will enable eight-bit input (it
|
||||
will not clear the eighth bit in the characters it reads),
|
||||
regardless of what the terminal claims it can support. The
|
||||
default value is @samp{off}. The name @code{meta-flag} is a
|
||||
synonym for this variable.
|
||||
default value is @samp{off}, but Readline will set it to @samp{on} if the
|
||||
locale contains eight-bit characters.
|
||||
The name @code{meta-flag} is a synonym for this variable.
|
||||
|
||||
@item isearch-terminators
|
||||
@vindex isearch-terminators
|
||||
@@ -666,7 +671,9 @@ the list. The default is @samp{off}.
|
||||
@vindex output-meta
|
||||
If set to @samp{on}, Readline will display characters with the
|
||||
eighth bit set directly rather than as a meta-prefixed escape
|
||||
sequence. The default is @samp{off}.
|
||||
sequence.
|
||||
The default is @samp{off}, but Readline will set it to @samp{on} if the
|
||||
locale contains eight-bit characters.
|
||||
|
||||
@item page-completions
|
||||
@vindex page-completions
|
||||
|
||||
@@ -4,7 +4,7 @@ Copyright (C) 1988-2016 Free Software Foundation, Inc.
|
||||
|
||||
@set EDITION 7.0
|
||||
@set VERSION 7.0
|
||||
@set UPDATED 25 January 2016
|
||||
@set UPDATED-MONTH January 2016
|
||||
@set UPDATED 20 April 2016
|
||||
@set UPDATED-MONTH April 2016
|
||||
|
||||
@set LASTCHANGE Mon Jan 25 10:08:41 EST 2016
|
||||
@set LASTCHANGE Wed Apr 20 13:32:48 PDT 2016
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* funmap.c -- attach names to functions. */
|
||||
|
||||
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2016 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.
|
||||
@@ -194,6 +194,7 @@ static const FUNMAP default_funmap[] = {
|
||||
{ "vi-set-mark", rl_vi_set_mark },
|
||||
{ "vi-subst", rl_vi_subst },
|
||||
{ "vi-tilde-expand", rl_vi_tilde_expand },
|
||||
{ "vi-unix-word-rubout", rl_vi_unix_word_rubout },
|
||||
{ "vi-yank-arg", rl_vi_yank_arg },
|
||||
{ "vi-yank-pop", rl_vi_yank_pop },
|
||||
{ "vi-yank-to", rl_vi_yank_to },
|
||||
|
||||
@@ -1220,7 +1220,7 @@ history_expand (hstring, output)
|
||||
ADD_STRING (temp);
|
||||
xfree (temp);
|
||||
}
|
||||
only_printing = r == 1;
|
||||
only_printing += r == 1;
|
||||
i = eindex;
|
||||
}
|
||||
break;
|
||||
@@ -1421,7 +1421,7 @@ history_tokenize_word (string, ind)
|
||||
const char *string;
|
||||
int ind;
|
||||
{
|
||||
register int i;
|
||||
register int i, j;
|
||||
int delimiter, nestdelim, delimopen;
|
||||
|
||||
i = ind;
|
||||
@@ -1433,6 +1433,22 @@ history_tokenize_word (string, ind)
|
||||
return i;
|
||||
}
|
||||
|
||||
if (isdigit (string[i]))
|
||||
{
|
||||
j = i;
|
||||
while (string[j] && isdigit (string[j]))
|
||||
j++;
|
||||
if (string[j] == 0)
|
||||
return (j);
|
||||
if (string[j] == '<' || string[j] == '>')
|
||||
i = j; /* digit sequence is a file descriptor */
|
||||
else
|
||||
{
|
||||
i = j;
|
||||
goto get_word; /* digit sequence is part of a word */
|
||||
}
|
||||
}
|
||||
|
||||
if (member (string[i], "<>;&|$"))
|
||||
{
|
||||
int peek = string[i + 1];
|
||||
@@ -1446,8 +1462,16 @@ history_tokenize_word (string, ind)
|
||||
i += 2;
|
||||
return i;
|
||||
}
|
||||
else if ((peek == '&' && (string[i] == '>' || string[i] == '<')) ||
|
||||
(peek == '>' && string[i] == '&'))
|
||||
else if (peek == '&' && (string[i] == '>' || string[i] == '<'))
|
||||
{
|
||||
j = i + 2;
|
||||
while (string[j] && isdigit (string[j])) /* file descriptor */
|
||||
j++;
|
||||
if (string[j] =='-') /* <&[digits]-, >&[digits]- */
|
||||
j++;
|
||||
return j;
|
||||
}
|
||||
else if ((peek == '>' && string[i] == '&') || (peek == '|' && string[i] == '>'))
|
||||
{
|
||||
i += 2;
|
||||
return i;
|
||||
|
||||
@@ -76,7 +76,4 @@ extern char *strchr ();
|
||||
#define HISTORY_APPEND 0
|
||||
#define HISTORY_OVERWRITE 1
|
||||
|
||||
/* Some variable definitions shared across history source files. */
|
||||
extern int history_offset;
|
||||
|
||||
#endif /* !_HISTLIB_H_ */
|
||||
|
||||
@@ -56,8 +56,6 @@
|
||||
static int rl_digit_loop PARAMS((void));
|
||||
static void _rl_history_set_point PARAMS((void));
|
||||
|
||||
extern int history_offset;
|
||||
|
||||
/* Forward declarations used in this file */
|
||||
void _rl_free_history_entry PARAMS((HIST_ENTRY *));
|
||||
|
||||
|
||||
@@ -965,7 +965,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
|
||||
/* Tentative inter-character timeout for potential multi-key
|
||||
sequences? If no input within timeout, abort sequence and
|
||||
act as if we got non-matching input. */
|
||||
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued[B
|
||||
/* _rl_keyseq_timeout specified in milliseconds; _rl_input_queued
|
||||
takes microseconds, so multiply by 1000 */
|
||||
if (_rl_keyseq_timeout > 0 &&
|
||||
(RL_ISSTATE (RL_STATE_INPUTPENDING|RL_STATE_MACROINPUT) == 0) &&
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Readline.h -- the names of functions callable from within readline. */
|
||||
|
||||
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2016 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.
|
||||
@@ -253,6 +253,7 @@ extern int rl_vi_yank_pop PARAMS((int, int));
|
||||
extern int rl_vi_rubout PARAMS((int, int));
|
||||
extern int rl_vi_delete PARAMS((int, int));
|
||||
extern int rl_vi_back_to_indent PARAMS((int, int));
|
||||
extern int rl_vi_unix_word_rubout PARAMS((int, int));
|
||||
extern int rl_vi_first_print PARAMS((int, int));
|
||||
extern int rl_vi_char_search PARAMS((int, int));
|
||||
extern int rl_vi_match PARAMS((int, int));
|
||||
@@ -378,6 +379,7 @@ extern void rl_redisplay PARAMS((void));
|
||||
extern int rl_on_new_line PARAMS((void));
|
||||
extern int rl_on_new_line_with_prompt PARAMS((void));
|
||||
extern int rl_forced_update_display PARAMS((void));
|
||||
extern int rl_clear_visible_line PARAMS((void));
|
||||
extern int rl_clear_message PARAMS((void));
|
||||
extern int rl_reset_line_state PARAMS((void));
|
||||
extern int rl_crlf PARAMS((void));
|
||||
|
||||
+19
-1
@@ -1,7 +1,7 @@
|
||||
/* rltty.c -- functions to prepare and restore the terminal for readline's
|
||||
use. */
|
||||
|
||||
/* Copyright (C) 1992-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1992-2016 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.
|
||||
@@ -714,6 +714,19 @@ rl_deprep_terminal ()
|
||||
_rl_release_sigint ();
|
||||
}
|
||||
#endif /* !NO_TTY_DRIVER */
|
||||
|
||||
/* Set readline's idea of whether or not it is echoing output to the terminal,
|
||||
returning the old value. */
|
||||
int
|
||||
rl_tty_set_echoing (u)
|
||||
int u;
|
||||
{
|
||||
int o;
|
||||
|
||||
o = _rl_echoing_p;
|
||||
_rl_echoing_p = u;
|
||||
return o;
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
@@ -876,6 +889,11 @@ _rl_bind_tty_special_chars (kmap, ttybuff)
|
||||
# endif /* VLNEXT && TERMIOS_TTY_DRIVER */
|
||||
|
||||
# if defined (VWERASE) && defined (TERMIOS_TTY_DRIVER)
|
||||
# if defined (VI_MODE)
|
||||
if (rl_editing_mode == vi_mode)
|
||||
SET_SPECIAL (VWERASE, rl_vi_unix_word_rubout);
|
||||
else
|
||||
# endif
|
||||
SET_SPECIAL (VWERASE, rl_unix_word_rubout);
|
||||
# endif /* VWERASE && TERMIOS_TTY_DRIVER */
|
||||
}
|
||||
|
||||
+1
-1
@@ -572,7 +572,7 @@ rl_refresh_line (ignore1, ignore2)
|
||||
|
||||
_rl_clear_to_eol (0); /* arg of 0 means to not use spaces */
|
||||
|
||||
rl_forced_update_display ();
|
||||
rl_redraw_prompt_last_line ();
|
||||
rl_display_fixed = 1;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -236,7 +236,11 @@ tilde_expand (string)
|
||||
string += end;
|
||||
|
||||
expansion = tilde_expand_word (tilde_word);
|
||||
xfree (tilde_word);
|
||||
|
||||
if (expansion == 0)
|
||||
expansion = tilde_word;
|
||||
else
|
||||
xfree (tilde_word);
|
||||
|
||||
len = strlen (expansion);
|
||||
#ifdef __CYGWIN__
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* vi_keymap.c -- the keymap for vi_mode in readline (). */
|
||||
|
||||
/* Copyright (C) 1987-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2016 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.
|
||||
@@ -55,7 +55,7 @@ KEYMAP_ENTRY_ARRAY vi_movement_keymap = {
|
||||
{ ISFUNC, rl_transpose_chars }, /* Control-t */
|
||||
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
|
||||
{ ISFUNC, rl_quoted_insert }, /* Control-v */
|
||||
{ ISFUNC, rl_unix_word_rubout }, /* Control-w */
|
||||
{ ISFUNC, rl_vi_unix_word_rubout }, /* Control-w */
|
||||
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-x */
|
||||
{ ISFUNC, rl_yank }, /* Control-y */
|
||||
{ ISFUNC, (rl_command_func_t *)0x0 }, /* Control-z */
|
||||
@@ -334,7 +334,7 @@ KEYMAP_ENTRY_ARRAY vi_insertion_keymap = {
|
||||
{ ISFUNC, rl_transpose_chars }, /* Control-t */
|
||||
{ ISFUNC, rl_unix_line_discard }, /* Control-u */
|
||||
{ ISFUNC, rl_quoted_insert }, /* Control-v */
|
||||
{ ISFUNC, rl_unix_word_rubout }, /* Control-w */
|
||||
{ ISFUNC, rl_vi_unix_word_rubout }, /* Control-w */
|
||||
{ ISFUNC, rl_insert }, /* Control-x */
|
||||
{ ISFUNC, rl_yank }, /* Control-y */
|
||||
{ ISFUNC, rl_insert }, /* Control-z */
|
||||
|
||||
+57
-1
@@ -1,7 +1,7 @@
|
||||
/* vi_mode.c -- A vi emulation mode for Bash.
|
||||
Derived from code written by Jeff Sparkes (jsparkes@bnr.ca). */
|
||||
|
||||
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2016 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.
|
||||
@@ -1620,6 +1620,62 @@ rl_vi_delete (count, key)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* This does what Posix specifies vi-mode C-w to do: using whitespace and
|
||||
punctuation characters as the word boundaries. */
|
||||
|
||||
#define vi_unix_word_boundary(c) (whitespace(c) || ispunct(c))
|
||||
|
||||
int
|
||||
rl_vi_unix_word_rubout (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int orig_point;
|
||||
|
||||
if (rl_point == 0)
|
||||
rl_ding ();
|
||||
else
|
||||
{
|
||||
orig_point = rl_point;
|
||||
if (count <= 0)
|
||||
count = 1;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
/* This isn't quite what ksh93 does but it seems to match what the
|
||||
Posix description of sh specifies, with a few accommodations
|
||||
for sequences of whitespace characters between words and at
|
||||
the end of the line. */
|
||||
|
||||
/* Skip over whitespace at the end of the line as a special case */
|
||||
if (rl_point > 0 && (rl_line_buffer[rl_point] == 0) &&
|
||||
whitespace (rl_line_buffer[rl_point - 1]))
|
||||
while (--rl_point > 0 && whitespace (rl_line_buffer[rl_point]))
|
||||
;
|
||||
|
||||
/* If we're at the start of a word, move back to word boundary so we
|
||||
move back to the `preceding' word */
|
||||
if (rl_point > 0 && (vi_unix_word_boundary (rl_line_buffer[rl_point]) == 0) &&
|
||||
vi_unix_word_boundary (rl_line_buffer[rl_point - 1]))
|
||||
rl_point--;
|
||||
|
||||
/* If we are at a word boundary (whitespace/punct), move backward
|
||||
past a sequence of word boundary characters. If we are at the
|
||||
end of a word (non-word boundary), move back to a word boundary */
|
||||
if (rl_point > 0 && vi_unix_word_boundary (rl_line_buffer[rl_point]))
|
||||
while (rl_point && vi_unix_word_boundary (rl_line_buffer[rl_point - 1]))
|
||||
rl_point--;
|
||||
else if (rl_point > 0 && vi_unix_word_boundary (rl_line_buffer[rl_point]) == 0)
|
||||
while (rl_point && (vi_unix_word_boundary (rl_line_buffer[rl_point - 1]) == 0))
|
||||
rl_point--;
|
||||
}
|
||||
|
||||
rl_kill_text (orig_point, rl_point);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rl_vi_back_to_indent (count, key)
|
||||
int count, key;
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ isnetconn (fd)
|
||||
l = sizeof(sa);
|
||||
rv = getpeername(fd, &sa, &l);
|
||||
/* Posix.2 says getpeername can return these errors. */
|
||||
return ((rv < 0 && (errno == ENOTSOCK || errno == ENOTCONN || errno == EINVAL)) ? 0 : 1);
|
||||
return ((rv < 0 && (errno == ENOTSOCK || errno == ENOTCONN || errno == EINVAL || errno == EBADF)) ? 0 : 1);
|
||||
#else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */
|
||||
# if defined (SVR4) || defined (SVR4_2)
|
||||
/* Sockets on SVR4 and SVR4.2 are character special (streams) devices. */
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ sh_regmatch (string, pattern, flags)
|
||||
/* Store the parenthesized subexpressions in the array BASH_REMATCH.
|
||||
Element 0 is the portion that matched the entire regexp. Element 1
|
||||
is the part that matched the first subexpression, and so on. */
|
||||
unbind_variable ("BASH_REMATCH");
|
||||
unbind_variable_noref ("BASH_REMATCH");
|
||||
rematch = make_new_array_variable ("BASH_REMATCH");
|
||||
amatch = array_cell (rematch);
|
||||
|
||||
|
||||
+21
-1
@@ -114,6 +114,23 @@ get_tmpdir (flags)
|
||||
return tdir;
|
||||
}
|
||||
|
||||
static void
|
||||
sh_seedrand ()
|
||||
{
|
||||
#if HAVE_RANDOM
|
||||
int d;
|
||||
static int seeded = 0;
|
||||
if (seeded == 0)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday (&tv, NULL);
|
||||
srandom (tv.tv_sec ^ tv.tv_usec ^ (getpid () << 16) ^ (unsigned int)&d);
|
||||
seeded = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
sh_mktmpname (nameroot, flags)
|
||||
char *nameroot;
|
||||
@@ -122,6 +139,7 @@ sh_mktmpname (nameroot, flags)
|
||||
char *filename, *tdir, *lroot;
|
||||
struct stat sb;
|
||||
int r, tdlen;
|
||||
static int seeded = 0;
|
||||
|
||||
filename = (char *)xmalloc (PATH_MAX + 1);
|
||||
tdir = get_tmpdir (flags);
|
||||
@@ -137,6 +155,7 @@ sh_mktmpname (nameroot, flags)
|
||||
filename = NULL;
|
||||
}
|
||||
#else /* !USE_MKTEMP */
|
||||
sh_seedrand ();
|
||||
while (1)
|
||||
{
|
||||
filenum = (filenum << 1) ^
|
||||
@@ -167,7 +186,7 @@ sh_mktmpfd (nameroot, flags, namep)
|
||||
{
|
||||
char *filename, *tdir, *lroot;
|
||||
int fd, tdlen;
|
||||
|
||||
|
||||
filename = (char *)xmalloc (PATH_MAX + 1);
|
||||
tdir = get_tmpdir (flags);
|
||||
tdlen = strlen (tdir);
|
||||
@@ -186,6 +205,7 @@ sh_mktmpfd (nameroot, flags, namep)
|
||||
*namep = filename;
|
||||
return fd;
|
||||
#else /* !USE_MKSTEMP */
|
||||
sh_seedrand ();
|
||||
do
|
||||
{
|
||||
filenum = (filenum << 1) ^
|
||||
|
||||
+5
-1
@@ -236,7 +236,11 @@ tilde_expand (string)
|
||||
string += end;
|
||||
|
||||
expansion = tilde_expand_word (tilde_word);
|
||||
xfree (tilde_word);
|
||||
|
||||
if (expansion == 0)
|
||||
expansion = tilde_word;
|
||||
else
|
||||
xfree (tilde_word);
|
||||
|
||||
len = strlen (expansion);
|
||||
#ifdef __CYGWIN__
|
||||
|
||||
Reference in New Issue
Block a user