commit bash-20071011 snapshot

This commit is contained in:
Chet Ramey
2011-12-07 09:14:01 -05:00
parent d21bf20140
commit 3d4e09aa28
39 changed files with 7221 additions and 6415 deletions
+7 -3
View File
@@ -1102,7 +1102,7 @@ rl_redisplay ()
tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
else
tx = nleft;
if (_rl_last_c_pos > tx)
if (tx >= 0 && _rl_last_c_pos > tx)
{
_rl_backspace (_rl_last_c_pos - tx); /* XXX */
_rl_last_c_pos = tx;
@@ -1251,7 +1251,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
int current_line, omax, nmax, inv_botlin;
{
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
int temp, lendiff, wsatend, od, nd, twidth;
int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
#if defined (HANDLE_MULTIBYTE)
@@ -1514,6 +1514,8 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
_rl_last_c_pos = lendiff + modmark;
}
o_cpos = _rl_last_c_pos;
/* When this function returns, _rl_last_c_pos is correct, and an absolute
cursor postion in multibyte mode, but a buffer index when not in a
multibyte locale. */
@@ -1523,7 +1525,9 @@ 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 && _rl_last_c_pos == prompt_physical_chars)
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;
#endif
#endif
+1 -1
View File
@@ -154,7 +154,7 @@ _rl_unget_char (key)
{
pop_index--;
if (pop_index < 0)
pop_index = ibuffer_len - 1;
pop_index = ibuffer_len;
ibuffer[pop_index] = key;
return (1);
}
+11 -3
View File
@@ -133,8 +133,11 @@ rl_get_char (key)
return (0);
*key = ibuffer[pop_index++];
#if 0
if (pop_index >= ibuffer_len)
#else
if (pop_index > ibuffer_len)
#endif
pop_index = 0;
return (1);
@@ -250,7 +253,8 @@ rl_gather_tyi ()
while (chars_avail--)
{
k = (*rl_getc_function) (rl_instream);
rl_stuff_char (k);
if (rl_stuff_char (k) == 0)
break; /* some problem; no more room */
if (k == NEWLINE || k == RETURN)
break;
}
@@ -373,7 +377,11 @@ rl_stuff_char (key)
RL_SETSTATE (RL_STATE_INPUTPENDING);
}
ibuffer[push_index++] = key;
#if 0
if (push_index >= ibuffer_len)
#else
if (push_index > ibuffer_len)
#endif
push_index = 0;
return 1;
@@ -570,7 +578,7 @@ _rl_read_mbstring (first, mb, mlen)
c = first;
memset (mb, 0, mlen);
for (i = 0; c > 0 && i < mlen; i++)
for (i = 0; c >= 0 && i < mlen; i++)
{
mb[i] = (char)c;
memset (&ps, 0, sizeof (mbstate_t));
+11 -9
View File
@@ -255,19 +255,21 @@ getcwd (buf, size)
{
size_t len = pathbuf + pathsize - pathp;
if (buf == NULL)
{
if (len < (size_t) size)
len = size;
buf = (char *) malloc (len);
if (buf == NULL)
goto lose2;
}
else if ((size_t) size < len)
if (buf == NULL && size <= 0)
size = len;
if ((size_t) size < len)
{
errno = ERANGE;
goto lose2;
}
if (buf == NULL)
{
buf = (char *) malloc (size);
if (buf == NULL)
goto lose2;
}
(void) memcpy((PTR_T) buf, (PTR_T) pathp, len);
}
+4
View File
@@ -26,6 +26,10 @@
#pragma alloca
#endif /* _AIX && RISC6000 && !__GNUC__ */
#if defined (__QNX__)
# undef HAVE_LSTAT
#endif
#include <bashtypes.h>
#include <errno.h>