diff options
author | Tomas Heinrich <heinrich.tomas@gmail.com> | 2010-06-01 08:33:18 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-01 08:33:18 +0200 |
commit | 11bcf4b22449d08b61617183c1951db98457653a (patch) | |
tree | 34d1983e1f1b5eb38d8c764ab9f2b406404b862e /libbb/lineedit.c | |
parent | 39a04f71ca8ccf81de2cdbd538df519cf34ef2e6 (diff) | |
download | busybox-w32-11bcf4b22449d08b61617183c1951db98457653a.tar.gz busybox-w32-11bcf4b22449d08b61617183c1951db98457653a.tar.bz2 busybox-w32-11bcf4b22449d08b61617183c1951db98457653a.zip |
lineedit: fix column display for wide and combining chars in TAB completion
function old new delta
unicode_strwidth - 20 +20
read_line_input 4945 4953 +8
unicode_strlen 31 - -31
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 1/0 up/down: 28/-31) Total: -3 bytes
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r-- | libbb/lineedit.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 18664b8c1..8a2ea7974 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -992,7 +992,7 @@ static void showfiles(void) | |||
992 | 992 | ||
993 | /* find the longest file name - use that as the column width */ | 993 | /* find the longest file name - use that as the column width */ |
994 | for (row = 0; row < nrows; row++) { | 994 | for (row = 0; row < nrows; row++) { |
995 | l = unicode_strlen(matches[row]); | 995 | l = unicode_strwidth(matches[row]); |
996 | if (column_width < l) | 996 | if (column_width < l) |
997 | column_width = l; | 997 | column_width = l; |
998 | } | 998 | } |
@@ -1012,10 +1012,13 @@ static void showfiles(void) | |||
1012 | 1012 | ||
1013 | for (nc = 1; nc < ncols && n+nrows < nfiles; n += nrows, nc++) { | 1013 | for (nc = 1; nc < ncols && n+nrows < nfiles; n += nrows, nc++) { |
1014 | printf("%s%-*s", matches[n], | 1014 | printf("%s%-*s", matches[n], |
1015 | (int)(column_width - unicode_strlen(matches[n])), "" | 1015 | (int)(column_width - unicode_strwidth(matches[n])), "" |
1016 | ); | 1016 | ); |
1017 | } | 1017 | } |
1018 | puts(matches[n]); | 1018 | if (ENABLE_UNICODE_SUPPORT) |
1019 | puts(printable_string(NULL, matches[n])); | ||
1020 | else | ||
1021 | puts(matches[n]); | ||
1019 | } | 1022 | } |
1020 | } | 1023 | } |
1021 | 1024 | ||