commit bash-20060202 snapshot

This commit is contained in:
Chet Ramey
2011-12-03 22:44:49 -05:00
parent ac18b31230
commit 2abb725592
12 changed files with 945 additions and 75 deletions
+12 -22
View File
@@ -88,7 +88,7 @@ static int inv_lbsize, vis_lbsize;
current cursor position is in the middle of a prompt string containing
invisible characters. */
#define PROMPT_ENDING_INDEX \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible)
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible+1)
/* **************************************************************** */
@@ -977,7 +977,11 @@ rl_redisplay ()
invisible character in the prompt string. */
nleft = prompt_visible_length + wrap_offset;
if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
#if 0
_rl_last_c_pos <= PROMPT_ENDING_INDEX && local_prompt)
#else
_rl_last_c_pos < PROMPT_ENDING_INDEX && local_prompt)
#endif
{
#if defined (__MSDOS__)
putc ('\r', rl_outstream);
@@ -1997,28 +2001,14 @@ _rl_make_prompt_for_search (pchar)
rl_save_prompt ();
if (saved_local_prompt == 0)
{
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, rl_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
}
else
{
len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, saved_local_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
local_prompt = savestring (pmt);
prompt_last_invisible = saved_last_invisible;
prompt_visible_length = saved_visible_length + 1;
}
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, rl_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
/* will be overwritten by expand_prompt, called from rl_message */
prompt_physical_chars = saved_physical_chars + 1;
return pmt;
+18 -24
View File
@@ -83,6 +83,14 @@ static int inv_lbsize, vis_lbsize;
by backing up or outputting a carriage return and moving forward. */
#define CR_FASTER(new, cur) (((new) + 1) < ((cur) - (new)))
/* _rl_last_c_pos is an absolute cursor position in multibyte locales and a
buffer index in others. This macro is used when deciding whether the
current cursor position is in the middle of a prompt string containing
invisible characters. */
#define PROMPT_ENDING_INDEX \
((MB_CUR_MAX > 1 && rl_byte_oriented == 0) ? prompt_physical_chars : prompt_last_invisible)
/* **************************************************************** */
/* */
/* Display stuff */
@@ -969,7 +977,7 @@ rl_redisplay ()
invisible character in the prompt string. */
nleft = prompt_visible_length + wrap_offset;
if (cursor_linenum == 0 && wrap_offset > 0 && _rl_last_c_pos > 0 &&
_rl_last_c_pos <= prompt_last_invisible && local_prompt)
_rl_last_c_pos <= PROMPT_ENDING_INDEX && local_prompt)
{
#if defined (__MSDOS__)
putc ('\r', rl_outstream);
@@ -1166,7 +1174,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
int col_lendiff, col_temp;
#if defined (HANDLE_MULTIBYTE)
mbstate_t ps_new, ps_old;
int new_offset, old_offset, tmp;
int new_offset, old_offset;
#endif
/* If we're at the right edge of a terminal that supports xn, we're
@@ -1403,7 +1411,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
od = ofd - old; /* index of first difference in visible line */
if (current_line == 0 && !_rl_horizontal_scroll_mode &&
_rl_term_cr && lendiff > prompt_visible_length && _rl_last_c_pos > 0 &&
od >= lendiff && _rl_last_c_pos <= prompt_last_invisible)
od >= lendiff && _rl_last_c_pos <= PROMPT_ENDING_INDEX)
{
#if defined (__MSDOS__)
putc ('\r', rl_outstream);
@@ -1989,28 +1997,14 @@ _rl_make_prompt_for_search (pchar)
rl_save_prompt ();
if (saved_local_prompt == 0)
{
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, rl_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
}
else
{
len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, saved_local_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
local_prompt = savestring (pmt);
prompt_last_invisible = saved_last_invisible;
prompt_visible_length = saved_visible_length + 1;
}
len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
pmt = (char *)xmalloc (len + 2);
if (len)
strcpy (pmt, rl_prompt);
pmt[len] = pchar;
pmt[len+1] = '\0';
/* will be overwritten by expand_prompt, called from rl_message */
prompt_physical_chars = saved_physical_chars + 1;
return pmt;
+4 -1
View File
@@ -69,7 +69,10 @@
#define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
#define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
int rl_prefer_env_winsize;
/* If the calling application sets this to a non-zero value, readline will
use the $LINES and $COLUMNS environment variables to set its idea of the
window size before interrogating the kernel. */
int rl_prefer_env_winsize = 0;
/* **************************************************************** */
/* */