commit bash-20101025 snapshot

This commit is contained in:
Chet Ramey
2011-12-12 22:09:11 -05:00
parent bf19c529dd
commit e05be32def
90 changed files with 29015 additions and 6199 deletions
+8 -2
View File
@@ -2450,7 +2450,10 @@ rl_old_menu_complete (count, invoking_key)
match_list_index += count;
if (match_list_index < 0)
match_list_index += match_list_size;
{
while (match_list_index < 0)
match_list_index += match_list_size;
}
else
match_list_index %= match_list_size;
@@ -2615,7 +2618,10 @@ rl_menu_complete (count, ignore)
match_list_index += count;
if (match_list_index < 0)
match_list_index += match_list_size;
{
while (match_list_index < 0)
match_list_index += match_list_size;
}
else
match_list_index %= match_list_size;
+5 -2
View File
@@ -197,7 +197,7 @@ int _rl_skip_completed_text = 0;
/* If non-zero, menu completion displays the common prefix first in the
cycle of possible completions instead of the last. */
int _rl_menu_complete_prefix_first = 1;
int _rl_menu_complete_prefix_first = 0;
/* If non-zero, then this is the address of a function to call when
completing on a directory name. The function is called with
@@ -2450,7 +2450,10 @@ rl_old_menu_complete (count, invoking_key)
match_list_index += count;
if (match_list_index < 0)
match_list_index += match_list_size;
{
while (match_list_index < 0)
match_list_index += match_list_size;
}
else
match_list_index %= match_list_size;
+1 -1
View File
@@ -1235,7 +1235,7 @@ Kill from point to the end of the current word, or if between
words, to the end of the next word.
Word boundaries are the same as @code{shell-forward-word}.
@item backward-kill-word ()
@item shell-backward-kill-word ()
Kill the word behind point.
Word boundaries are the same as @code{shell-backward-word}.
@end ifset
+1
View File
@@ -345,6 +345,7 @@ extern void _rl_set_cursor PARAMS((int, int));
/* text.c */
extern void _rl_fix_point PARAMS((int));
extern int _rl_replace_text PARAMS((const char *, int, int));
extern int _rl_forward_char_internal PARAMS((int));
extern int _rl_insert_char PARAMS((int, int));
extern int _rl_overwrite_char PARAMS((int, int));
extern int _rl_overwrite_rubout PARAMS((int, int));
+1
View File
@@ -418,6 +418,7 @@ extern int _rl_completion_case_map;
extern int _rl_match_hidden_files;
extern int _rl_page_completions;
extern int _rl_skip_completed_text;
extern int _rl_menu_complete_prefix_first;
/* display.c */
extern int _rl_vis_botlin;
+34 -14
View File
@@ -265,11 +265,13 @@ rl_forward_byte (count, key)
if (count > 0)
{
int end = rl_point + count;
int end, lend;
end = rl_point + count;
#if defined (VI_MODE)
int lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
#else
int lend = rl_end;
lend = rl_end;
#endif
if (end > lend)
@@ -287,6 +289,31 @@ rl_forward_byte (count, key)
return 0;
}
int
_rl_forward_char_internal (count)
int count;
{
int point;
#if defined (HANDLE_MULTIBYTE)
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
#if defined (VI_MODE)
if (point >= rl_end && VI_COMMAND_MODE())
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
#endif
if (rl_end < 0)
rl_end = 0;
#else
point = rl_point + count;
if (point > rl_end)
point = rl_end;
#endif
return (point);
}
#if defined (HANDLE_MULTIBYTE)
/* Move forward COUNT characters. */
int
@@ -309,20 +336,12 @@ rl_forward_char (count, key)
return 0;
}
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
#if defined (VI_MODE)
if (point >= rl_end && VI_COMMAND_MODE())
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
#endif
point = _rl_forward_char_internal (count);
if (rl_point == point)
rl_ding ();
rl_point = point;
if (rl_end < 0)
rl_end = 0;
}
return 0;
@@ -805,8 +824,9 @@ _rl_insert_char (count, c)
/* We are inserting a single character.
If there is pending input, then make a string of all of the
pending characters that are bound to rl_insert, and insert
them all. */
if (_rl_any_typein ())
them all. Don't do this if we're current reading input from
a macro. */
if ((RL_ISSTATE (RL_STATE_MACROINPUT) == 0) && _rl_any_typein ())
_rl_insert_typein (c);
else
{
+37 -18
View File
@@ -150,7 +150,7 @@ rl_delete_text (from, to)
if (_rl_doing_an_undo == 0)
rl_add_undo (UNDO_DELETE, from, to, text);
else
free (text);
xfree (text);
rl_end -= diff;
rl_line_buffer[rl_end] = '\0';
@@ -265,11 +265,13 @@ rl_forward_byte (count, key)
if (count > 0)
{
int end = rl_point + count;
int end, lend;
end = rl_point + count;
#if defined (VI_MODE)
int lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
lend = rl_end > 0 ? rl_end - (VI_COMMAND_MODE()) : rl_end;
#else
int lend = rl_end;
lend = rl_end;
#endif
if (end > lend)
@@ -287,6 +289,31 @@ rl_forward_byte (count, key)
return 0;
}
int
_rl_forward_char_internal (count)
int count;
{
int point;
#if defined (HANDLE_MULTIBYTE)
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
#if defined (VI_MODE)
if (point >= rl_end && VI_COMMAND_MODE())
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
#endif
if (rl_end < 0)
rl_end = 0;
#else
point = rl_point + count;
if (point > rl_end)
point = rl_end;
#endif
return (point);
}
#if defined (HANDLE_MULTIBYTE)
/* Move forward COUNT characters. */
int
@@ -309,20 +336,12 @@ rl_forward_char (count, key)
return 0;
}
point = _rl_find_next_mbchar (rl_line_buffer, rl_point, count, MB_FIND_NONZERO);
#if defined (VI_MODE)
if (point >= rl_end && VI_COMMAND_MODE())
point = _rl_find_prev_mbchar (rl_line_buffer, rl_end, MB_FIND_NONZERO);
#endif
point = _rl_forward_char_internal (count);
if (rl_point == point)
rl_ding ();
rl_point = point;
if (rl_end < 0)
rl_end = 0;
}
return 0;
@@ -752,7 +771,7 @@ _rl_insert_char (count, c)
string[i] = '\0';
rl_insert_text (string);
free (string);
xfree (string);
return 0;
}
@@ -779,7 +798,7 @@ _rl_insert_char (count, c)
count -= decreaser;
}
free (string);
xfree (string);
incoming_length = 0;
stored_count = 0;
#else /* !HANDLE_MULTIBYTE */
@@ -1407,8 +1426,8 @@ rl_transpose_words (count, key)
/* I think that does it. */
rl_end_undo_group ();
free (word1);
free (word2);
xfree (word1);
xfree (word2);
return 0;
}
@@ -1467,7 +1486,7 @@ rl_transpose_chars (count, key)
rl_end_undo_group ();
#if defined (HANDLE_MULTIBYTE)
free (dummy);
xfree (dummy);
#endif
return 0;
+46 -42
View File
@@ -630,12 +630,16 @@ _rl_vi_append_forward (key)
if (MB_CUR_MAX == 1 || rl_byte_oriented)
rl_point++;
else
{
point = rl_point;
rl_forward_char (1, key);
if (point == rl_point)
rl_point = rl_end;
}
{
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;
}
}
}
@@ -733,7 +737,7 @@ _rl_vi_done_inserting ()
_rl_vi_last_key_before_insert == 'a' ||
_rl_vi_last_key_before_insert == 'I' ||
_rl_vi_last_key_before_insert == 'A'))
_rl_vi_save_insert (rl_undo_list);
_rl_vi_save_insert (rl_undo_list);
/* XXX - Other keys probably need to be checked. */
else if (_rl_vi_last_key_before_insert == 'C')
rl_end_undo_group ();
@@ -793,7 +797,7 @@ _rl_vi_change_mbchar_case (count)
if (MB_INVALIDCH (m))
wc = (wchar_t)rl_line_buffer[rl_point];
else if (MB_NULLWCH (m))
wc = L'\0';
wc = L'\0';
if (iswupper (wc))
wc = towlower (wc);
else if (iswlower (wc))
@@ -821,7 +825,7 @@ _rl_vi_change_mbchar_case (count)
rl_vi_check ();
}
else
rl_forward_char (1, 0);
rl_forward_char (1, 0);
}
return 0;
@@ -868,7 +872,7 @@ rl_vi_change_case (count, ignore)
_rl_insert_char (1, c);
rl_end_undo_group ();
rl_vi_check ();
}
}
else
rl_forward_char (1, c);
}
@@ -906,7 +910,7 @@ rl_vi_check ()
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
else
rl_point--;
rl_point--;
}
return (0);
}
@@ -1059,7 +1063,7 @@ rl_domove_motion_callback (m)
/* Posix.2 says that if cw or cW moves the cursor towards the end of
the line, the character under the cursor should be deleted. */
if (rl_point == rl_mark)
rl_point++;
rl_point++;
else
{
/* Move past the end of the word so that the kill doesn't
@@ -1099,7 +1103,7 @@ rl_domove_read_callback (m)
/* If we just read a vi-mode motion command numeric argument, turn off
the `reading numeric arg' state */
if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_VIMOVENUMARG())
RL_UNSETSTATE (RL_STATE_NUMERICARG);
RL_UNSETSTATE (RL_STATE_NUMERICARG);
#endif
/* Should do everything, including turning off RL_STATE_VIMOTION */
return (rl_domove_motion_callback (m));
@@ -1137,10 +1141,10 @@ rl_domove_read_callback (m)
rl_numeric_arg *= save;
c = rl_vi_domove_getchar (m);
if (c < 0)
{
m->motion = 0;
return -1;
}
{
m->motion = 0;
return -1;
}
m->motion = c;
return (rl_domove_motion_callback (m));
}
@@ -1288,7 +1292,7 @@ vi_change_dispatch (m)
rl_kill_text (rl_point, rl_mark);
/* `C' does not save the text inserted for undoing or redoing. */
if (_rl_uppercase_p (m->key) == 0)
_rl_vi_doing_insert = 1;
_rl_vi_doing_insert = 1;
/* XXX -- TODO -- use m->numericarg? */
rl_vi_start_inserting (m->key, rl_numeric_arg, rl_arg_sign);
}
@@ -1562,23 +1566,23 @@ rl_vi_char_search (count, key)
else
{
switch (key)
{
case 't':
_rl_cs_orig_dir = _rl_cs_dir = FTO;
break;
{
case 't':
_rl_cs_orig_dir = _rl_cs_dir = FTO;
break;
case 'T':
_rl_cs_orig_dir = _rl_cs_dir = BTO;
break;
case 'T':
_rl_cs_orig_dir = _rl_cs_dir = BTO;
break;
case 'f':
_rl_cs_orig_dir = _rl_cs_dir = FFIND;
break;
case 'f':
_rl_cs_orig_dir = _rl_cs_dir = FFIND;
break;
case 'F':
_rl_cs_orig_dir = _rl_cs_dir = BFIND;
break;
}
case 'F':
_rl_cs_orig_dir = _rl_cs_dir = BFIND;
break;
}
if (vi_redoing)
{
@@ -1586,12 +1590,12 @@ rl_vi_char_search (count, key)
}
#if defined (READLINE_CALLBACKS)
else if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_callback_data = _rl_callback_data_alloc (count);
_rl_callback_data->i1 = _rl_cs_dir;
_rl_callback_func = _rl_vi_callback_char_search;
return (0);
}
{
_rl_callback_data = _rl_callback_data_alloc (count);
_rl_callback_data->i1 = _rl_cs_dir;
_rl_callback_func = _rl_vi_callback_char_search;
return (0);
}
#endif
else
{
@@ -1642,7 +1646,7 @@ rl_vi_match (ignore, key)
pre = rl_point;
rl_forward_char (1, key);
if (pre == rl_point)
break;
break;
}
}
else
@@ -1671,7 +1675,7 @@ rl_vi_match (ignore, key)
{
pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY);
if (tmp == pos)
pos--;
pos--;
}
if (pos >= 0)
{
@@ -1919,8 +1923,8 @@ rl_vi_replace (count, key)
vi_replace_map[NEWLINE].function = rl_newline;
/* If the normal vi insertion keymap has ^H bound to erase, do the
same here. Probably should remove the assignment to RUBOUT up
there, but I don't think it will make a difference in real life. */
same here. Probably should remove the assignment to RUBOUT up
there, but I don't think it will make a difference in real life. */
if (vi_insertion_keymap[CTRL ('H')].type == ISFUNC &&
vi_insertion_keymap[CTRL ('H')].function == rl_rubout)
vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete;
+47 -43
View File
@@ -630,12 +630,16 @@ _rl_vi_append_forward (key)
if (MB_CUR_MAX == 1 || rl_byte_oriented)
rl_point++;
else
{
point = rl_point;
rl_forward_char (1, key);
if (point == rl_point)
rl_point = rl_end;
}
{
point = rl_point;
#if 0
rl_forward_char (1, key);
#else
_rl_forward_char_internal (1);
#endif
if (point == rl_point)
rl_point = rl_end;
}
}
}
@@ -733,7 +737,7 @@ _rl_vi_done_inserting ()
_rl_vi_last_key_before_insert == 'a' ||
_rl_vi_last_key_before_insert == 'I' ||
_rl_vi_last_key_before_insert == 'A'))
_rl_vi_save_insert (rl_undo_list);
_rl_vi_save_insert (rl_undo_list);
/* XXX - Other keys probably need to be checked. */
else if (_rl_vi_last_key_before_insert == 'C')
rl_end_undo_group ();
@@ -793,7 +797,7 @@ _rl_vi_change_mbchar_case (count)
if (MB_INVALIDCH (m))
wc = (wchar_t)rl_line_buffer[rl_point];
else if (MB_NULLWCH (m))
wc = L'\0';
wc = L'\0';
if (iswupper (wc))
wc = towlower (wc);
else if (iswlower (wc))
@@ -821,7 +825,7 @@ _rl_vi_change_mbchar_case (count)
rl_vi_check ();
}
else
rl_forward_char (1, 0);
rl_forward_char (1, 0);
}
return 0;
@@ -868,7 +872,7 @@ rl_vi_change_case (count, ignore)
_rl_insert_char (1, c);
rl_end_undo_group ();
rl_vi_check ();
}
}
else
rl_forward_char (1, c);
}
@@ -906,7 +910,7 @@ rl_vi_check ()
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
rl_point = _rl_find_prev_mbchar (rl_line_buffer, rl_point, MB_FIND_NONZERO);
else
rl_point--;
rl_point--;
}
return (0);
}
@@ -1011,7 +1015,7 @@ static void
_rl_mvcxt_dispose (m)
_rl_vimotion_cxt *m;
{
free (m);
xfree (m);
}
static int
@@ -1059,7 +1063,7 @@ rl_domove_motion_callback (m)
/* Posix.2 says that if cw or cW moves the cursor towards the end of
the line, the character under the cursor should be deleted. */
if (rl_point == rl_mark)
rl_point++;
rl_point++;
else
{
/* Move past the end of the word so that the kill doesn't
@@ -1099,7 +1103,7 @@ rl_domove_read_callback (m)
/* If we just read a vi-mode motion command numeric argument, turn off
the `reading numeric arg' state */
if (RL_ISSTATE (RL_STATE_CALLBACK) && RL_VIMOVENUMARG())
RL_UNSETSTATE (RL_STATE_NUMERICARG);
RL_UNSETSTATE (RL_STATE_NUMERICARG);
#endif
/* Should do everything, including turning off RL_STATE_VIMOTION */
return (rl_domove_motion_callback (m));
@@ -1137,10 +1141,10 @@ rl_domove_read_callback (m)
rl_numeric_arg *= save;
c = rl_vi_domove_getchar (m);
if (c < 0)
{
m->motion = 0;
return -1;
}
{
m->motion = 0;
return -1;
}
m->motion = c;
return (rl_domove_motion_callback (m));
}
@@ -1288,7 +1292,7 @@ vi_change_dispatch (m)
rl_kill_text (rl_point, rl_mark);
/* `C' does not save the text inserted for undoing or redoing. */
if (_rl_uppercase_p (m->key) == 0)
_rl_vi_doing_insert = 1;
_rl_vi_doing_insert = 1;
/* XXX -- TODO -- use m->numericarg? */
rl_vi_start_inserting (m->key, rl_numeric_arg, rl_arg_sign);
}
@@ -1562,23 +1566,23 @@ rl_vi_char_search (count, key)
else
{
switch (key)
{
case 't':
_rl_cs_orig_dir = _rl_cs_dir = FTO;
break;
{
case 't':
_rl_cs_orig_dir = _rl_cs_dir = FTO;
break;
case 'T':
_rl_cs_orig_dir = _rl_cs_dir = BTO;
break;
case 'T':
_rl_cs_orig_dir = _rl_cs_dir = BTO;
break;
case 'f':
_rl_cs_orig_dir = _rl_cs_dir = FFIND;
break;
case 'f':
_rl_cs_orig_dir = _rl_cs_dir = FFIND;
break;
case 'F':
_rl_cs_orig_dir = _rl_cs_dir = BFIND;
break;
}
case 'F':
_rl_cs_orig_dir = _rl_cs_dir = BFIND;
break;
}
if (vi_redoing)
{
@@ -1586,12 +1590,12 @@ rl_vi_char_search (count, key)
}
#if defined (READLINE_CALLBACKS)
else if (RL_ISSTATE (RL_STATE_CALLBACK))
{
_rl_callback_data = _rl_callback_data_alloc (count);
_rl_callback_data->i1 = _rl_cs_dir;
_rl_callback_func = _rl_vi_callback_char_search;
return (0);
}
{
_rl_callback_data = _rl_callback_data_alloc (count);
_rl_callback_data->i1 = _rl_cs_dir;
_rl_callback_func = _rl_vi_callback_char_search;
return (0);
}
#endif
else
{
@@ -1642,7 +1646,7 @@ rl_vi_match (ignore, key)
pre = rl_point;
rl_forward_char (1, key);
if (pre == rl_point)
break;
break;
}
}
else
@@ -1671,7 +1675,7 @@ rl_vi_match (ignore, key)
{
pos = _rl_find_prev_mbchar (rl_line_buffer, pos, MB_FIND_ANY);
if (tmp == pos)
pos--;
pos--;
}
if (pos >= 0)
{
@@ -1919,8 +1923,8 @@ rl_vi_replace (count, key)
vi_replace_map[NEWLINE].function = rl_newline;
/* If the normal vi insertion keymap has ^H bound to erase, do the
same here. Probably should remove the assignment to RUBOUT up
there, but I don't think it will make a difference in real life. */
same here. Probably should remove the assignment to RUBOUT up
there, but I don't think it will make a difference in real life. */
if (vi_insertion_keymap[CTRL ('H')].type == ISFUNC &&
vi_insertion_keymap[CTRL ('H')].function == rl_rubout)
vi_replace_map[CTRL ('H')].function = rl_vi_overstrike_delete;
+2
View File
@@ -176,6 +176,8 @@ ansicstr (string, len, flags, sawc, rlen)
else if ((flags & 1) == 0 && (c = *s))
{
s++;
if ((flags & 2) && c == '\\' && c == *s)
s++; /* Posix requires $'\c\\' do backslash escaping */
c = TOCTRL(c);
break;
}
+6 -5
View File
@@ -49,11 +49,9 @@ ansicstr (string, len, flags, sawc, rlen)
char *string;
int len, flags, *sawc, *rlen;
{
int c, temp, v;
int c, temp;
char *ret, *r, *s;
#if defined (HANDLE_MULTIBYTE)
char mbch[25]; /* 25 > MB_LEN_MAX, plus can handle 4-byte UTF-8 and large Unicode characters*/
#endif
unsigned long v;
if (string == 0 || *string == '\0')
return ((char *)NULL);
@@ -153,7 +151,6 @@ ansicstr (string, len, flags, sawc, rlen)
}
else
{
memset (mbch, '\0', sizeof (mbch));
temp = u32cconv (v, r);
r += temp;
continue;
@@ -174,9 +171,13 @@ ansicstr (string, len, flags, sawc, rlen)
*rlen = r - ret;
return ret;
}
else if ((flags & 1) == 0 && *s == 0)
; /* pass \c through */
else if ((flags & 1) == 0 && (c = *s))
{
s++;
if ((flags & 2) && c == '\\' && c == *s)
s++; /*
c = TOCTRL(c);
break;
}