bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

all invisible characters are attributed to the first line


From: agriffis
Subject: all invisible characters are attributed to the first line
Date: Mon, 2 Aug 2004 10:49:33 -0400

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib   -mcpu=athlon -O3 -pipe
uname output: Linux time.flatmonk.org 2.6.6-rc3 #1 Thu May 13 09:43:41 EDT 2004 
i686 AMD Athlon(tm) Processor AuthenticAMD GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 3.0
Patch Level: 0
Release Status: release

Description:
        When invisible characters appear in PS1 at a point past the
        screenwidth, they are nonetheless attributed to the first
        line.  The result is that bash will incorrectly wrap that many
        characters.

Repeat-By:
        Assuming a terminal width of 80 characters, the following will
        demonstrate the problem:
            # 120 characters is sufficient to demonstrate, then an invisible 
sequence
            
PS1='123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\[\033[0m\]'

Fix:
        Here is a patch to solve the problem.  Move the screenwidth test so
        that invfl (invisible characters on the first line) is only set
        immediately following the wrap.

--- bash-3.0/lib/readline/display.c.agriffis    2004-08-02 09:34:14.000000000 
-0400
+++ bash-3.0/lib/readline/display.c     2004-08-02 10:48:26.256360524 -0400
@@ -258,15 +258,16 @@
 #endif
            {
              *r++ = *p;
-             if (!ignoring)
-               rl++;                   /* visible length byte counter */
+             if (!ignoring) 
+               {
+                 rl++;                 /* visible length byte counter */
+                 if (rl >= _rl_screenwidth)
+                   invfl = ninvis;
+               }
              else
                ninvis++;               /* invisible chars byte counter */
            }
 
-         if (rl >= _rl_screenwidth)
-           invfl = ninvis;
-
          if (ignoring == 0)
            physchars++;
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]