Bash-4.1 distribution source
This commit is contained in:
parent
89a92869e5
commit
0001803f0b
252 changed files with 51563 additions and 37176 deletions
|
|
@ -67,6 +67,10 @@ static int _rl_insert_next_callback PARAMS((_rl_callback_generic_arg *));
|
|||
static int _rl_char_search_callback PARAMS((_rl_callback_generic_arg *));
|
||||
#endif
|
||||
|
||||
/* The largest chunk of text that can be inserted in one call to
|
||||
rl_insert_text. Text blocks larger than this are divided. */
|
||||
#define TEXT_COUNT_MAX 1024
|
||||
|
||||
/* **************************************************************** */
|
||||
/* */
|
||||
/* Insert and Delete */
|
||||
|
|
@ -185,10 +189,13 @@ _rl_replace_text (text, start, end)
|
|||
{
|
||||
int n;
|
||||
|
||||
n = 0;
|
||||
rl_begin_undo_group ();
|
||||
rl_delete_text (start, end + 1);
|
||||
if (start <= end)
|
||||
rl_delete_text (start, end + 1);
|
||||
rl_point = start;
|
||||
n = rl_insert_text (text);
|
||||
if (*text)
|
||||
n = rl_insert_text (text);
|
||||
rl_end_undo_group ();
|
||||
|
||||
return n;
|
||||
|
|
@ -570,6 +577,21 @@ rl_clear_screen (count, key)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_skip_csi_sequence (count, key)
|
||||
int count, key;
|
||||
{
|
||||
int ch;
|
||||
|
||||
RL_SETSTATE (RL_STATE_MOREINPUT);
|
||||
do
|
||||
ch = rl_read_key ();
|
||||
while (ch >= 0x20 && ch < 0x40);
|
||||
RL_UNSETSTATE (RL_STATE_MOREINPUT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rl_arrow_keys (count, c)
|
||||
int count, c;
|
||||
|
|
@ -707,7 +729,7 @@ _rl_insert_char (count, c)
|
|||
|
||||
/* If we can optimize, then do it. But don't let people crash
|
||||
readline because of extra large arguments. */
|
||||
if (count > 1 && count <= 1024)
|
||||
if (count > 1 && count <= TEXT_COUNT_MAX)
|
||||
{
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
string_size = count * incoming_length;
|
||||
|
|
@ -735,11 +757,11 @@ _rl_insert_char (count, c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (count > 1024)
|
||||
if (count > TEXT_COUNT_MAX)
|
||||
{
|
||||
int decreaser;
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
string_size = incoming_length * 1024;
|
||||
string_size = incoming_length * TEXT_COUNT_MAX;
|
||||
string = (char *)xmalloc (1 + string_size);
|
||||
|
||||
i = 0;
|
||||
|
|
@ -751,7 +773,7 @@ _rl_insert_char (count, c)
|
|||
|
||||
while (count)
|
||||
{
|
||||
decreaser = (count > 1024) ? 1024 : count;
|
||||
decreaser = (count > TEXT_COUNT_MAX) ? TEXT_COUNT_MAX : count;
|
||||
string[decreaser*incoming_length] = '\0';
|
||||
rl_insert_text (string);
|
||||
count -= decreaser;
|
||||
|
|
@ -761,14 +783,14 @@ _rl_insert_char (count, c)
|
|||
incoming_length = 0;
|
||||
stored_count = 0;
|
||||
#else /* !HANDLE_MULTIBYTE */
|
||||
char str[1024+1];
|
||||
char str[TEXT_COUNT_MAX+1];
|
||||
|
||||
for (i = 0; i < 1024; i++)
|
||||
for (i = 0; i < TEXT_COUNT_MAX; i++)
|
||||
str[i] = c;
|
||||
|
||||
while (count)
|
||||
{
|
||||
decreaser = (count > 1024 ? 1024 : count);
|
||||
decreaser = (count > TEXT_COUNT_MAX ? TEXT_COUNT_MAX : count);
|
||||
str[decreaser] = '\0';
|
||||
rl_insert_text (str);
|
||||
count -= decreaser;
|
||||
|
|
@ -1129,7 +1151,7 @@ int
|
|||
rl_delete_horizontal_space (count, ignore)
|
||||
int count, ignore;
|
||||
{
|
||||
int start = rl_point;
|
||||
int start;
|
||||
|
||||
while (rl_point && whitespace (rl_line_buffer[rl_point - 1]))
|
||||
rl_point--;
|
||||
|
|
@ -1247,6 +1269,7 @@ rl_change_case (count, op)
|
|||
wchar_t wc, nwc;
|
||||
char mb[MB_LEN_MAX+1];
|
||||
int mlen;
|
||||
size_t m;
|
||||
mbstate_t mps;
|
||||
#endif
|
||||
|
||||
|
|
@ -1299,7 +1322,11 @@ rl_change_case (count, op)
|
|||
#if defined (HANDLE_MULTIBYTE)
|
||||
else
|
||||
{
|
||||
mbrtowc (&wc, rl_line_buffer + start, end - start, &mps);
|
||||
m = mbrtowc (&wc, rl_line_buffer + start, end - start, &mps);
|
||||
if (MB_INVALIDCH (m))
|
||||
wc = (wchar_t)rl_line_buffer[start];
|
||||
else if (MB_NULLWCH (m))
|
||||
wc = L'\0';
|
||||
nwc = (nop == UpCase) ? _rl_to_wupper (wc) : _rl_to_wlower (wc);
|
||||
if (nwc != wc) /* just skip unchanged characters */
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue