[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
multibyte completion broken on some locales
From: |
Jiro SEKIBA |
Subject: |
multibyte completion broken on some locales |
Date: |
Mon, 18 Aug 2003 16:07:12 +0900 |
User-agent: |
Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI) |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: cc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu'
-DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H -I. -I../src -I../src/include
-I../src/lib
uname output: Linux harlequin 2.4.17 #1 Wed Feb 20 18:34:43 JST 2002 i686
GNU/Linux
Machine Type: i386-pc-linux-gnu
Bash Version: 2.05b
Patch Level: 0
Release Status: release
Description:
readline completion functionality automatically adds escape character
just before the shell special characters. However some codesets
like SJIS, have shell speciall characters in byte sequences.
Repeat-By:
$ unset LC_ALL
$ export LANG=ja_JP.SJIS
$ touch `printf "a\x89\5c"`
$ ls a[TAB]
then you'll see escape character '\' added
0x895c in SJIS is U+5642 in Unicode
Fix:
diff -ru bash-2.05b.orig/lib/readline/complete.c
bash-2.05b/lib/readline/complete.c
--- bash-2.05b.orig/lib/readline/complete.c 2002-05-08 04:39:32.000000000
+0900
+++ bash-2.05b/lib/readline/complete.c 2003-07-03 14:52:37.000000000 +0900
@@ -663,7 +663,14 @@
quote substrings for the completer. Try to find the start
of an unclosed quoted substring. */
/* FOUND_QUOTE is set so we know what kind of quotes we found. */
- for (scan = pass_next = 0; scan < end; scan++)
+ for (scan = pass_next = 0; scan < end;
+#if defined(HANDLE_MULTIBYTE)
+ scan = ((MB_CUR_MAX == 1 || rl_byte_oriented) ?
+ (scan + 1) :
+ _rl_find_next_mbchar(rl_line_buffer,scan,1,MB_FIND_ANY)))
+#else
+ scan++)
+#endif
{
if (pass_next)
{
diff -ru bash-2.05b.orig/lib/readline/rldefs.h bash-2.05b/lib/readline/rldefs.h
--- bash-2.05b.orig/lib/readline/rldefs.h 2002-05-08 04:40:07.000000000
+0900
+++ bash-2.05b/lib/readline/rldefs.h 2003-07-03 14:04:50.000000000 +0900
@@ -77,7 +77,7 @@
extern int _rl_strnicmp PARAMS((char *, char *, int));
#endif
-#if defined (HAVE_STRPBRK)
+#if defined (HAVE_STRPBRK) && ! defined(HANDLE_MULTIBYTE)
# define _rl_strpbrk(a,b) strpbrk((a),(b))
#else
extern char *_rl_strpbrk PARAMS((const char *, const char *));
diff -ru bash-2.05b.orig/lib/readline/util.c bash-2.05b/lib/readline/util.c
--- bash-2.05b.orig/lib/readline/util.c 2002-03-14 06:45:43.000000000 +0900
+++ bash-2.05b/lib/readline/util.c 2003-07-03 14:04:50.000000000 +0900
@@ -223,7 +223,7 @@
return ((char *)NULL);
}
-#ifndef HAVE_STRPBRK
+#if defined(HAVE_STRPBRK) || defined(HANDLE_MULTIBYTE)
/* Find the first occurrence in STRING1 of any character from STRING2.
Return a pointer to the character in STRING1. */
char *
@@ -250,7 +250,7 @@
{
v = _rl_get_char_len (string1, &ps);
if (v > 1)
- string += v - 1; /* -1 to account for auto-increment in loop */
+ string1 += v - 1; /* -1 to account for auto-increment in loop */
}
#endif
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- multibyte completion broken on some locales,
Jiro SEKIBA <=