* [rfa] fix readline utf-8 display bug
@ 2003-01-09 21:24 Michael Elizabeth Chastain
2003-01-10 22:23 ` Elena Zannoni
0 siblings, 1 reply; 3+ messages in thread
From: Michael Elizabeth Chastain @ 2003-01-09 21:24 UTC (permalink / raw)
To: gdb-patches
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 */
-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfa] fix readline utf-8 display bug
2003-01-09 21:24 [rfa] fix readline utf-8 display bug Michael Elizabeth Chastain
@ 2003-01-10 22:23 ` Elena Zannoni
0 siblings, 0 replies; 3+ messages in thread
From: Elena Zannoni @ 2003-01-10 22:23 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches
Michael Elizabeth Chastain writes:
> 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?
Sure.
Thanks for following this up.
Elena
>
> 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 */
> -
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfa] fix readline utf-8 display bug
@ 2003-01-11 0:44 Michael Elizabeth Chastain
0 siblings, 0 replies; 3+ messages in thread
From: Michael Elizabeth Chastain @ 2003-01-11 0:44 UTC (permalink / raw)
To: ezannoni; +Cc: gdb-patches
Committed.
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-11 0:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-09 21:24 [rfa] fix readline utf-8 display bug Michael Elizabeth Chastain
2003-01-10 22:23 ` Elena Zannoni
2003-01-11 0:44 Michael Elizabeth Chastain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox