summaryrefslogtreecommitdiff
path: root/readline
diff options
context:
space:
mode:
authorMichael Chastain <mec.gnu@mindspring.com>2003-01-11 00:43:53 +0000
committerMichael Chastain <mec.gnu@mindspring.com>2003-01-11 00:43:53 +0000
commitb1ba8aef3127e19a1d5187c8bc5b1c814031feb4 (patch)
tree454eb720ad31e305d4d82d8ee1600246bf90f2b6 /readline
parentc28e5774f743bf2922f1ee3084ef4dc5a1bbd435 (diff)
downloadgdb-b1ba8aef3127e19a1d5187c8bc5b1c814031feb4.tar.gz
2003-01-09 Michael Chastain <mec@shout.net>
From Chet Ramey, <chet@po.cwru.edu>, the readline maintainer: * display.c: Fix perverse screen refresh with UTF-8.
Diffstat (limited to 'readline')
-rw-r--r--readline/ChangeLog.gdb5
-rw-r--r--readline/display.c26
2 files changed, 19 insertions, 12 deletions
diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb
index 1c2df78f63a..73230181702 100644
--- a/readline/ChangeLog.gdb
+++ b/readline/ChangeLog.gdb
@@ -1,3 +1,8 @@
+2003-01-09 Michael Chastain <mec@shout.net>
+
+ From Chet Ramey, <chet@po.cwru.edu>, the readline maintainer:
+ * display.c: Fix perverse screen refresh with UTF-8.
+
2003-01-08 Chris Demetriou <cgd@broadcom.com>
* config.guess: Update to 2003-01-03 version.
diff --git a/readline/display.c b/readline/display.c
index dec0de3e0d7..e151cf2862b 100644
--- a/readline/display.c
+++ b/readline/display.c
@@ -74,7 +74,7 @@ static void insert_some_chars PARAMS((char *, int, int));
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))
@@ -1352,9 +1352,9 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
{
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
#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);
+#else
+ _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
#endif
}
}
@@ -1514,8 +1514,15 @@ _rl_move_cursor_relative (new, data)
#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 is not obvious and must 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
@@ -1598,11 +1605,7 @@ _rl_move_cursor_relative (new, data)
#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);
}
@@ -2144,7 +2147,7 @@ _rl_current_display_line ()
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;
@@ -2220,4 +2223,3 @@ _rl_col_width (str, start, end)
return width;
}
#endif /* HANDLE_MULTIBYTE */
-