commit bash-20040902 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 13:35:53 -05:00
parent be7d8f2da4
commit 37c41ab12b
42 changed files with 22871 additions and 17142 deletions
+29 -6
View File
@@ -250,7 +250,10 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
while (l--)
*r++ = *p++;
if (!ignoring)
rl += ind - pind;
{
rl += ind - pind;
physchars += _rl_col_width (pmt, pind, ind);
}
else
ninvis += ind - pind;
p--; /* compensate for later increment */
@@ -260,7 +263,10 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
{
*r++ = *p;
if (!ignoring)
rl++; /* visible length byte counter */
{
rl++; /* visible length byte counter */
physchars++;
}
else
ninvis++; /* invisible chars byte counter */
}
@@ -270,9 +276,6 @@ expand_prompt (pmt, lp, lip, niflp, vlp)
invfl = ninvis;
invflset = 1;
}
if (ignoring == 0)
physchars++;
}
}
@@ -421,7 +424,7 @@ rl_redisplay ()
register int in, out, c, linenum, cursor_linenum;
register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum;
int newlines, lpos, temp, modmark;
int newlines, lpos, temp, modmark, n0, num;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
@@ -577,6 +580,7 @@ rl_redisplay ()
#if defined (HANDLE_MULTIBYTE)
memset (_rl_wrapped_line, 0, vis_lbsize);
num = 0;
#endif
/* prompt_invis_chars_first_line is the number of invisible characters in
@@ -595,13 +599,32 @@ rl_redisplay ()
probably too much work for the benefit gained. How many people have
prompts that exceed two physical lines?
Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
#if defined (HANDLE_MULTIBYTE)
n0 = num;
temp = local_prompt ? strlen (local_prompt) : 0;
while (num < temp)
{
if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth)
{
num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
break;
}
num++;
}
temp = num +
#else
temp = ((newlines + 1) * _rl_screenwidth) +
#endif /* !HANDLE_MULTIBYTE */
((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
: ((newlines == 1) ? wrap_offset : 0))
: ((newlines == 0) ? wrap_offset :0));
inv_lbreaks[++newlines] = temp;
#if defined (HANDLE_MULTIBYTE)
lpos -= _rl_col_width (local_prompt, n0, num);
#else
lpos -= _rl_screenwidth;
#endif
}
prompt_last_screen_line = newlines;