File bash-2.05b-display.patch of Package compat-readline4
--- lib/readline/display.c
+++ lib/readline/display.c 2002-08-30 19:24:43.000000000 +0900
@@ -70,7 +70,7 @@
static void cr PARAMS((void));
#if defined (HANDLE_MULTIBYTE)
-static int _rl_col_width PARAMS((char *, int, int));
+static int _rl_col_width PARAMS((const char *, int, int));
static int *_rl_wrapped_line;
#else
# define _rl_col_width(l, s, e) (((e) <= (s)) ? 0 : (e) - (s))
@@ -1350,7 +1350,7 @@
#if 0
_rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff) - col_lendiff;
#else
- _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
+ _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
#endif
}
}
@@ -1510,8 +1510,15 @@
#if defined (HANDLE_MULTIBYTE)
/* If we have multibyte characters, NEW is indexed by the buffer point in
a multibyte string, but _rl_last_c_pos is the display position. In
- this case, NEW's display position is not obvious. */
- if ((MB_CUR_MAX == 1 || rl_byte_oriented ) && _rl_last_c_pos == new) return;
+ this case, NEW's display position sould be calculated.
+ */
+ if ( MB_CUR_MAX == 1 || rl_byte_oriented )
+ {
+ if ( _rl_last_c_pos == new )
+ return ;
+ }
+ else if( _rl_last_c_pos == _rl_col_width(data,0,new) )
+ return;
#else
if (_rl_last_c_pos == new) return;
#endif
@@ -1594,11 +1601,7 @@
#endif
{
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
- {
- tputs (_rl_term_cr, 1, _rl_output_character_function);
- for (i = 0; i < new; i++)
- putc (data[i], rl_outstream);
- }
+ _rl_backspace(_rl_last_c_pos - _rl_col_width(data,0,new));
else
_rl_backspace (_rl_last_c_pos - new);
}
@@ -2117,7 +2120,7 @@
scan from the beginning of the string to take the state into account. */
static int
_rl_col_width (str, start, end)
- char *str;
+ const char *str;
int start, end;
{
wchar_t wc;