Subject: Re: incorrect handling of invisible characters in prompt string
From: [email-masked] (Eric Blake)
To: Koen Claessen <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 27 Feb 2006 14:48:37 +0000

[Please use mailing lists instead of sending private mail
to random developers - I don't know whether you
intended this as a question about bash proper or
about the cygwin port of bash, so I have cross-posted
my reply]

> Hi Eric,
> 
> I found the following message (from July 2005) by you on the cygwin 
> mailing list:
> 
> http://cygwin.com/ml/cygwin/2005-07/msg00659.html
> 
> As you probably know, that bug is still there :-)

Yes, readline 5.1 still mishandles invisible characters present
in one-line prompts when compiled for multibyte support, at
least on cygwin, and I still don't know a root cause.

> 
> Do you have any info on bug status, workarounds, etc.? I would be happy 
> for any kind of advice.

If you are using the cygwin packaging of readline 5.1, I use
the following hack to force the redisplay of the entire
line in question (obviously not a correct patch, but at
least a workaround to avoid the display bug):

diff -urN -x .build -x .inst -x .sinst readline-5.0-orig/display.c readline-5.0/
display.c
--- readline-5.0-orig/display.c 2005-07-28 21:58:19.451125000 -0600
+++ readline-5.0/display.c      2005-07-28 21:55:55.779250000 -0600
@@ -286,7 +286,10 @@
   if (lp)
     *lp = rl;
   if (lip)
-    *lip = last;
+    /* Hack: faking that \[\] was always the last part of the prompt reduces
+       (but does not completely solve) double character prompt display bugs. */
+    *lip = r - ret;
+/*    *lip = last; */
   if (niflp)
     *niflp = invfl;
   if  (vlp)

-- 
Eric Blake
volunteer cygwin bash maintainer

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/