bash-custom-action/readline-5.2-update-line.patch

48 lines
1.6 KiB
Diff

--- display.c 2007/04/11 08:37:02 1.48
+++ display.c 2007/04/11 08:41:29
@@ -1589,8 +1589,22 @@ update_line (old, new, current_line, oma
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. */
@@ -1598,8 +1612,20 @@ update_line (old, new, current_line, oma
{
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)