From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Received: (qmail 5380 invoked from network); 10 Jan 2003 22:23:12 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by 209.249.29.67 with SMTP; 10 Jan 2003 22:23:12 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h0ALt6B00902 for ; Fri, 10 Jan 2003 16:55:06 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0AMN0a02029 for ; Fri, 10 Jan 2003 17:23:00 -0500 Received: from localhost.redhat.com (romulus-int.sfbay.redhat.com [172.16.27.46]) by pobox.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0AMMxS03838 for ; Fri, 10 Jan 2003 17:22:59 -0500 Received: by localhost.redhat.com (Postfix, from userid 469) id 89C4DFF79; Fri, 10 Jan 2003 17:27:22 -0500 (EST) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15903.18634.251009.640862@localhost.redhat.com> Date: Fri, 10 Jan 2003 22:23:00 -0000 To: Michael Elizabeth Chastain Cc: gdb-patches@sources.redhat.com Subject: Re: [rfa] fix readline utf-8 display bug In-Reply-To: <200301092124.h09LOLk07593@duracef.shout.net> References: <200301092124.h09LOLk07593@duracef.shout.net> X-SW-Source: 2003-01/txt/msg00426.txt.bz2 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 > > From Chet Ramey, , 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 */ > -