summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-07 06:45:33 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-07 06:45:33 -0800
commitd15e0b892dd68880b25170631c97567dc6056795 (patch)
treed169134cada384e13efeb372dd5df133ca3b4de7
parent08bea85fa1e2b674bf0e03e17ac206545ae1ff2a (diff)
downloadreadline-d15e0b892dd68880b25170631c97567dc6056795.tar.gz
readline-d15e0b892dd68880b25170631c97567dc6056795.tar.bz2
readline-d15e0b892dd68880b25170631c97567dc6056795.zip
applied patch readline52-008
-rw-r--r--display.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/display.c b/display.c
index be675ad..ab87339 100644
--- a/display.c
+++ b/display.c
@@ -1048,7 +1048,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;
@@ -1204,7 +1204,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;
+ int temp, lendiff, wsatend, od, nd, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
#if defined (HANDLE_MULTIBYTE)
@@ -1465,6 +1465,8 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
_rl_last_c_pos = lendiff;
}
+ 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. */
@@ -1474,7 +1476,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