bug-bash
[Top][All Lists]
Advanced

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

incorrect handling of invisible characters in prompt string


From: Thomas Dickey
Subject: incorrect handling of invisible characters in prompt string
Date: Tue, 12 Jul 2005 20:12:21 +0100 (BST)

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: netbsdelf
Compiler: cc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='netbsdelf' -DCONF_MACHTYPE='i386--netbsdelf' -DCONF_VENDOR='' 
-DLOCALEDIR='/usr/pkg/share/locale' -DPACKAGE='bash' -DSHELL  -DHAVE_CONFIG_H  
-I.  -I. -I./include -I./lib  -I/usr/include -O2 -I/usr/include
uname output: NetBSD colwyn.zhadum.de 3.0_BETA NetBSD 3.0_BETA (COLWYN) #0: Sat 
Jun 18 20:48:09 BST 2005  
tron@colwyn.zhadum.de:/export/scratch/tron/build.21314a/sys/compile/COLWYN i386
Machine Type: i386--netbsdelf

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

Description:
        An extra character is displayed in the prompt.  Tracing the code
        to see where it went astray, I could see that it appears to assume
        that the invisible characters are all in one chunk.  Using the
        bundled copy of readline, it is producing incorrect results starting
        at display.c in this chunk beginning at line 1372:

          /* If we are changing the number of invisible characters in a line, 
and 
             the spot of first difference is before the end of the invisible 
chars, 
             lendiff needs to be adjusted. */

        After that, it makes these calls (note that the "c" is passed as part
        of the invisible-character chunk):

                _rl_output_some_chars(c)
                _rl_output_some_chars(olwyn:~$)
                _rl_move_cursor_relative(new=22, data=colwyn:~$)

        Finally, the extra character shows up via putc() called from line 1686.

        The problem shows up if $TERM is xterm which includes 

                :ei=\E[4l:im=\E[4h:

        and causes the _rl_move_cursor_relative() call to switch to insert
        mode when adding the extra character.  There is no logic to handle
        the case where insert-mode is not available - it appears to simply
        overwrite the cell in that case.

Repeat-By:
        Set

        TERM=xterm
        PS1='\[\033[01;35m\]\h\[\033[00m\]:\w\$'

        then "cd ~".

Fix:
        [Description of how to fix the problem.  If you don't know a
        fix for the problem, don't include this section.]




reply via email to

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