bug-bash
[Top][All Lists]
Advanced

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

COMP_POINT is not set correctly when there is non-ascii characters in th


From: yyc1992
Subject: COMP_POINT is not set correctly when there is non-ascii characters in the command line.
Date: Thu, 22 Mar 2012 18:59:55 -0400 (EDT)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' 
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=x86-64 
-mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 
-D_FORTIFY_SOURCE=2 
-DDEFAULT_PATH_VALUE='/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin'
 -DSTANDARD_UTILS_PATH='/usr/bin:/bin:/usr/sbin:/sbin' 
-DSYS_BASHRC='/etc/bash.bashrc' -DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
uname output: Linux yuyichao-PC 3.2.11-1-ARCH #1 SMP PREEMPT Thu Mar 15 
09:19:02 CET 2012 x86_64 Intel(R) Core(TM)2 Duo CPU T9600 @ 2.80GHz 
GenuineIntel GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.2
Patch Level: 24
Release Status: release

Description:
        The variable COMP_POINT is actually set to the size (not the length) of 
the command line before the cursor, whereas ${#COMP_LINE} returns the length of 
the string. This behavior make it hard to determine where the cursor is when 
the commandline contain non-ascii characters and it is NOT consistent with the 
statement in bash(1) which says these two are the same when the cursor is at 
the end of the line.

Repeat-By:
        $ a() { COMPREPLY=('' "${COMP_POINT}" "${#COMP_LINE}"); }
        $ complete -F a a
        $ a 啊 a<TAB>
        from the generated completion list, we can see two different numbers, 
which means these two value are not the same!!



reply via email to

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