commit bash-snap-20170620 snapshot

This commit is contained in:
Chet Ramey
2017-06-20 10:38:13 -04:00
parent 6374eecf23
commit d7d836dfc5
16 changed files with 195 additions and 34 deletions
+2
View File
@@ -2128,6 +2128,7 @@ dumb_update:
}
#if 1
#ifdef HANDLE_MULTIBYTE
/* If we write a non-space into the last screen column,
remove the note that we added a space to compensate for
a multibyte double-width character that didn't fit, since
@@ -2137,6 +2138,7 @@ dumb_update:
line_state_invisible->wrapped_line[current_line+1] &&
nfd[bytes_to_insert-1] != ' ')
line_state_invisible->wrapped_line[current_line+1] = 0;
#endif
#endif
}
else
+3 -2
View File
@@ -655,7 +655,7 @@ _rl_read_mbchar (char *mbchar, int size)
int
_rl_read_mbstring (int first, char *mb, int mlen)
{
int i, c;
int i, c, n;
mbstate_t ps;
c = first;
@@ -664,7 +664,8 @@ _rl_read_mbstring (int first, char *mb, int mlen)
{
mb[i] = (char)c;
memset (&ps, 0, sizeof (mbstate_t));
if (_rl_get_char_len (mb, &ps) == -2)
n = _rl_get_char_len (mb, &ps);
if (n == -2)
{
/* Read more for multibyte character */
RL_SETSTATE (RL_STATE_MOREINPUT);
+6 -2
View File
@@ -223,9 +223,13 @@ _rl_find_prev_mbchar_internal (char *string, int seed, int find_non_zero)
int
_rl_get_char_len (char *src, mbstate_t *ps)
{
size_t tmp;
size_t tmp, l;
int mb_cur_max;
tmp = mbrlen((const char *)src, MB_CUR_MAX, ps);
/* Look at no more than MB_CUR_MAX characters */
l = (size_t)strlen (src);
mb_cur_max = MB_CUR_MAX;
tmp = mbrlen((const char *)src, (l < mb_cur_max) ? l : mb_cur_max, ps);
if (tmp == (size_t)(-2))
{
/* shorted to compose multibyte char */
+23 -13
View File
@@ -101,7 +101,7 @@ static int _rl_vi_last_search_mblen;
#else
static int _rl_vi_last_search_char;
#endif
static int _rl_vi_last_replacement;
static char _rl_vi_last_replacement[MB_LEN_MAX+1]; /* reserve for trailing NULL */
static int _rl_vi_last_key_before_insert;
@@ -646,11 +646,7 @@ _rl_vi_append_forward (int key)
else
{
point = rl_point;
#if 0
rl_forward_char (1, key);
#else
rl_point = _rl_forward_char_internal (1);
#endif
if (point == rl_point)
rl_point = rl_end;
}
@@ -1889,7 +1885,7 @@ _rl_vi_change_char (int count, int c, char *mb)
p = rl_point;
rl_vi_delete (1, c);
if (rl_point < p) /* Did we retreat at EOL? */
rl_point++;
_rl_vi_append_forward (c);
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_insert_text (mb);
@@ -1931,9 +1927,15 @@ static int
_rl_vi_callback_change_char (_rl_callback_generic_arg *data)
{
int c;
char mb[MB_LEN_MAX];
char mb[MB_LEN_MAX+1];
_rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
#if defined (HANDLE_MULTIBYTE)
strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
#else
_rl_vi_last_replacement[0] = c;
#endif
_rl_vi_last_replacement[MB_LEN_MAX] = '\0'; /* XXX */
if (c < 0)
return -1;
@@ -1949,13 +1951,13 @@ int
rl_vi_change_char (int count, int key)
{
int c;
char mb[MB_LEN_MAX];
char mb[MB_LEN_MAX+1];
if (_rl_vi_redoing)
{
c = _rl_vi_last_replacement;
mb[0] = c;
mb[1] = '\0';
strncpy (mb, _rl_vi_last_replacement, MB_LEN_MAX);
c = (unsigned char)_rl_vi_last_replacement[0]; /* XXX */
mb[MB_LEN_MAX] = '\0';
}
#if defined (READLINE_CALLBACKS)
else if (RL_ISSTATE (RL_STATE_CALLBACK))
@@ -1966,7 +1968,15 @@ rl_vi_change_char (int count, int key)
}
#endif
else
_rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
{
c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
#ifdef HANDLE_MULTIBYTE
strncpy (_rl_vi_last_replacement, mb, MB_LEN_MAX);
#else
_rl_vi_last_replacement[0] = c;
#endif
_rl_vi_last_replacement[MB_LEN_MAX] = '\0'; /* just in case */
}
if (c < 0)
return -1;