From d15e0b892dd68880b25170631c97567dc6056795 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 7 Nov 2012 06:45:33 -0800 Subject: [PATCH] applied patch readline52-008 --- display.c | 10 +++++++--- 1 file 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 -- 2.7.4