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
commit6f402def6d87ebc5b043919e29df1b6e11dd8f0f (patch)
tree1e531abd598157c2e95054474ca2e192ac093b31
parentd5eaa1d872d33dc66bfb0304749b8038e65cb046 (diff)
downloadreadline-6f402def6d87ebc5b043919e29df1b6e11dd8f0f.tar.gz
readline-6f402def6d87ebc5b043919e29df1b6e11dd8f0f.tar.bz2
readline-6f402def6d87ebc5b043919e29df1b6e11dd8f0f.zip
applied patch readline52-004
-rw-r--r--display.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/display.c b/display.c
index 5a1004a..2f53c74 100644
--- a/display.c
+++ b/display.c
@@ -1598,8 +1598,22 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
temp = nls - nfd;
if (temp > 0)
{
+ /* If nfd begins at the prompt, or before the invisible
+ characters in the prompt, we need to adjust _rl_last_c_pos
+ in a multibyte locale to account for the wrap offset and
+ set cpos_adjusted accordingly. */
_rl_output_some_chars (nfd, temp);
- _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
+ }
+ else
+ _rl_last_c_pos += temp;
}
}
/* Otherwise, print over the existing material. */
@@ -1607,8 +1621,20 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
{
if (temp > 0)
{
+ /* If nfd begins at the prompt, or before the invisible
+ characters in the prompt, we need to adjust _rl_last_c_pos
+ in a multibyte locale to account for the wrap offset and
+ set cpos_adjusted accordingly. */
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp; /* XXX */
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
+ }
}
lendiff = (oe - old) - (ne - new);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)