applied bash 2.05b patches (only 002 was previously applied)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17325 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1044,7 +1044,10 @@ attempt_shell_completion (text, start, end)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#define CMD_IS_DIR(x) (absolute_pathname(x) == 0 && *(x) != '~' && test_for_directory (x))
|
||||||
|
|
||||||
matches = rl_completion_matches (text, command_word_completion_function);
|
matches = rl_completion_matches (text, command_word_completion_function);
|
||||||
|
|
||||||
/* If we are attempting command completion and nothing matches, we
|
/* If we are attempting command completion and nothing matches, we
|
||||||
do not want readline to perform filename completion for us. We
|
do not want readline to perform filename completion for us. We
|
||||||
still want to be able to complete partial pathnames, so set the
|
still want to be able to complete partial pathnames, so set the
|
||||||
@@ -1052,7 +1055,7 @@ attempt_shell_completion (text, start, end)
|
|||||||
filenames and leave directories in the match list. */
|
filenames and leave directories in the match list. */
|
||||||
if (matches == (char **)NULL)
|
if (matches == (char **)NULL)
|
||||||
rl_ignore_some_completions_function = bash_ignore_filenames;
|
rl_ignore_some_completions_function = bash_ignore_filenames;
|
||||||
else if (matches[1] == 0 && *matches[0] != '/')
|
else if (matches[1] == 0 && CMD_IS_DIR(matches[0]))
|
||||||
/* Turn off rl_filename_completion_desired so readline doesn't
|
/* Turn off rl_filename_completion_desired so readline doesn't
|
||||||
append a slash if there is a directory with the same name
|
append a slash if there is a directory with the same name
|
||||||
in the current directory, or other filename-specific things.
|
in the current directory, or other filename-specific things.
|
||||||
@@ -1061,7 +1064,7 @@ attempt_shell_completion (text, start, end)
|
|||||||
looking in the current directory anyway, so there's no
|
looking in the current directory anyway, so there's no
|
||||||
conflict. */
|
conflict. */
|
||||||
rl_filename_completion_desired = 0;
|
rl_filename_completion_desired = 0;
|
||||||
else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && *matches[0] != '/')
|
else if (matches[0] && matches[1] && STREQ (matches[0], matches[1]) && CMD_IS_DIR (matches[0]))
|
||||||
/* There are multiple instances of the same match (duplicate
|
/* There are multiple instances of the same match (duplicate
|
||||||
completions haven't yet been removed). In this case, all of
|
completions haven't yet been removed). In this case, all of
|
||||||
the matches will be the same, and the duplicate removal code
|
the matches will be the same, and the duplicate removal code
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ rl_generic_bind (type, keyseq, data, map)
|
|||||||
mapped to something, `abc' to be mapped to something else,
|
mapped to something, `abc' to be mapped to something else,
|
||||||
and the function bound to `a' to be executed when the user
|
and the function bound to `a' to be executed when the user
|
||||||
types `abx', leaving `bx' in the input queue. */
|
types `abx', leaving `bx' in the input queue. */
|
||||||
if (k.function /* && k.type == ISFUNC */)
|
if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR))
|
||||||
{
|
{
|
||||||
map[ANYOTHERKEY] = k;
|
map[ANYOTHERKEY] = k;
|
||||||
k.function = 0;
|
k.function = 0;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ static void insert_some_chars PARAMS((char *, int, int));
|
|||||||
static void cr PARAMS((void));
|
static void cr PARAMS((void));
|
||||||
|
|
||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
static int _rl_col_width PARAMS((char *, int, int));
|
static int _rl_col_width PARAMS((const char *, int, int));
|
||||||
static int *_rl_wrapped_line;
|
static int *_rl_wrapped_line;
|
||||||
#else
|
#else
|
||||||
# define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
|
# define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
|
||||||
@@ -1348,9 +1348,9 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
|
|||||||
{
|
{
|
||||||
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
|
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
|
||||||
#if 0
|
#if 0
|
||||||
_rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff) - col_lendiff;
|
|
||||||
#else
|
|
||||||
_rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
|
_rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
|
||||||
|
#else
|
||||||
|
_rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1510,8 +1510,15 @@ _rl_move_cursor_relative (new, data)
|
|||||||
#if defined (HANDLE_MULTIBYTE)
|
#if defined (HANDLE_MULTIBYTE)
|
||||||
/* If we have multibyte characters, NEW is indexed by the buffer point in
|
/* If we have multibyte characters, NEW is indexed by the buffer point in
|
||||||
a multibyte string, but _rl_last_c_pos is the display position. In
|
a multibyte string, but _rl_last_c_pos is the display position. In
|
||||||
this case, NEW's display position is not obvious. */
|
this case, NEW's display position is not obvious and must be
|
||||||
if ((MB_CUR_MAX == 1 || rl_byte_oriented ) && _rl_last_c_pos == new) return;
|
calculated. */
|
||||||
|
if (MB_CUR_MAX == 1 || rl_byte_oriented)
|
||||||
|
{
|
||||||
|
if (_rl_last_c_pos == new)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (_rl_last_c_pos == _rl_col_width (data, 0, new))
|
||||||
|
return;
|
||||||
#else
|
#else
|
||||||
if (_rl_last_c_pos == new) return;
|
if (_rl_last_c_pos == new) return;
|
||||||
#endif
|
#endif
|
||||||
@@ -1594,11 +1601,7 @@ _rl_move_cursor_relative (new, data)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
|
||||||
{
|
_rl_backspace (_rl_last_c_pos - _rl_col_width (data, 0, new));
|
||||||
tputs (_rl_term_cr, 1, _rl_output_character_function);
|
|
||||||
for (i = 0; i < new; i++)
|
|
||||||
putc (data[i], rl_outstream);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
_rl_backspace (_rl_last_c_pos - new);
|
_rl_backspace (_rl_last_c_pos - new);
|
||||||
}
|
}
|
||||||
@@ -2117,7 +2120,7 @@ _rl_current_display_line ()
|
|||||||
scan from the beginning of the string to take the state into account. */
|
scan from the beginning of the string to take the state into account. */
|
||||||
static int
|
static int
|
||||||
_rl_col_width (str, start, end)
|
_rl_col_width (str, start, end)
|
||||||
char *str;
|
const char *str;
|
||||||
int start, end;
|
int start, end;
|
||||||
{
|
{
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
@@ -2193,4 +2196,3 @@ _rl_col_width (str, start, end)
|
|||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
#endif /* HANDLE_MULTIBYTE */
|
#endif /* HANDLE_MULTIBYTE */
|
||||||
|
|
||||||
|
|||||||
@@ -205,14 +205,16 @@ _rl_get_char_len (src, ps)
|
|||||||
if (tmp == (size_t)(-2))
|
if (tmp == (size_t)(-2))
|
||||||
{
|
{
|
||||||
/* shorted to compose multibyte char */
|
/* shorted to compose multibyte char */
|
||||||
memset (ps, 0, sizeof(mbstate_t));
|
if (ps)
|
||||||
|
memset (ps, 0, sizeof(mbstate_t));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
else if (tmp == (size_t)(-1))
|
else if (tmp == (size_t)(-1))
|
||||||
{
|
{
|
||||||
/* invalid to compose multibyte char */
|
/* invalid to compose multibyte char */
|
||||||
/* initialize the conversion state */
|
/* initialize the conversion state */
|
||||||
memset (ps, 0, sizeof(mbstate_t));
|
if (ps)
|
||||||
|
memset (ps, 0, sizeof(mbstate_t));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (tmp == (size_t)0)
|
else if (tmp == (size_t)0)
|
||||||
@@ -225,9 +227,12 @@ _rl_get_char_len (src, ps)
|
|||||||
return 1. Otherwise return 0. */
|
return 1. Otherwise return 0. */
|
||||||
int
|
int
|
||||||
_rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2)
|
_rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2)
|
||||||
char *buf1, *buf2;
|
char *buf1;
|
||||||
mbstate_t *ps1, *ps2;
|
int pos1;
|
||||||
int pos1, pos2;
|
mbstate_t *ps1;
|
||||||
|
char *buf2;
|
||||||
|
int pos2;
|
||||||
|
mbstate_t *ps2;
|
||||||
{
|
{
|
||||||
int i, w1, w2;
|
int i, w1, w2;
|
||||||
|
|
||||||
@@ -276,8 +281,11 @@ _rl_adjust_point(string, point, ps)
|
|||||||
pos++;
|
pos++;
|
||||||
/* clear the state of the byte sequence, because
|
/* clear the state of the byte sequence, because
|
||||||
in this case effect of mbstate is undefined */
|
in this case effect of mbstate is undefined */
|
||||||
memset (ps, 0, sizeof (mbstate_t));
|
if (ps)
|
||||||
|
memset (ps, 0, sizeof (mbstate_t));
|
||||||
}
|
}
|
||||||
|
else if (tmp == 0)
|
||||||
|
pos++;
|
||||||
else
|
else
|
||||||
pos += tmp;
|
pos += tmp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -680,7 +680,8 @@ _rl_vi_change_mbchar_case (count)
|
|||||||
int count;
|
int count;
|
||||||
{
|
{
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
char mb[MB_LEN_MAX];
|
char mb[MB_LEN_MAX+1];
|
||||||
|
int mblen;
|
||||||
mbstate_t ps;
|
mbstate_t ps;
|
||||||
|
|
||||||
memset (&ps, 0, sizeof (mbstate_t));
|
memset (&ps, 0, sizeof (mbstate_t));
|
||||||
@@ -703,7 +704,9 @@ _rl_vi_change_mbchar_case (count)
|
|||||||
/* Vi is kind of strange here. */
|
/* Vi is kind of strange here. */
|
||||||
if (wc)
|
if (wc)
|
||||||
{
|
{
|
||||||
wctomb (mb, wc);
|
mblen = wctomb (mb, wc);
|
||||||
|
if (mblen >= 0)
|
||||||
|
mb[mblen] = '\0';
|
||||||
rl_begin_undo_group ();
|
rl_begin_undo_group ();
|
||||||
rl_delete (1, 0);
|
rl_delete (1, 0);
|
||||||
rl_insert_text (mb);
|
rl_insert_text (mb);
|
||||||
|
|||||||
@@ -1638,11 +1638,10 @@ string_list_dollar_at (list, quoted)
|
|||||||
|
|
||||||
/* This performs word splitting and quoted null character removal on
|
/* This performs word splitting and quoted null character removal on
|
||||||
STRING. */
|
STRING. */
|
||||||
#if 0
|
#define issep(c) \
|
||||||
#define issep(c) ((separators)[1] ? (member ((c), separators)) : (c) == (separators)[0])
|
(((separators)[0]) ? ((separators)[1] ? isifs(c) \
|
||||||
#else
|
: (c) == (separators)[0]) \
|
||||||
#define issep(c) ((separators)[1] ? isifs(c) : (c) == (separators)[0])
|
: 0)
|
||||||
#endif
|
|
||||||
|
|
||||||
WORD_LIST *
|
WORD_LIST *
|
||||||
list_string (string, separators, quoted)
|
list_string (string, separators, quoted)
|
||||||
|
|||||||
Reference in New Issue
Block a user