From: Michael Elizabeth Chastain <mec@shout.net>
To: gdb-patches@sources.redhat.com
Subject: [rfa] fix readline utf-8 display bug
Date: Thu, 09 Jan 2003 21:24:00 -0000 [thread overview]
Message-ID: <200301092124.h09LOLk07593@duracef.shout.net> (raw)
This is a patch from Chet Ramey, the maintainer of readline, to fix
the problem with perverse screen refresh with UTF-8. This will fix
the problem with the test suite failing to run in UTF-8 environments
(the test suite patterns gets confuse by the bad perverse screen refresh).
I tested this in a standalone readline test program and in my gdb
testbed. It works for me with LANG=en_US.UTF-8 (my normal language).
I tested with and without the "LC_ALL=C" kludge currently in lib/gdb.exp.
If this patch goes in, then I can submit to patch to revert the
assignment to LC_ALL in lib/gdb.exp, and we'll be back to testing
in the user's specified locale.
Okay to apply?
Michael C
===
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.
Index: display.c
===================================================================
RCS file: /cvs/src/src/readline/display.c,v
retrieving revision 1.6
diff -u -r1.6 display.c
--- display.c 8 Dec 2002 22:31:37 -0000 1.6
+++ display.c 9 Jan 2003 21:17:22 -0000
@@ -74,7 +74,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))
@@ -1352,9 +1352,9 @@
{
_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 @@
#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 @@
#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 @@
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 @@
return width;
}
#endif /* HANDLE_MULTIBYTE */
-
next reply other threads:[~2003-01-09 21:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-09 21:24 Michael Elizabeth Chastain [this message]
2003-01-10 22:23 ` Elena Zannoni
2003-01-11 0:44 Michael Elizabeth Chastain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200301092124.h09LOLk07593@duracef.shout.net \
--to=mec@shout.net \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox