summaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorTomas Heinrich2010-06-01 08:33:18 +0200
committerDenys Vlasenko2010-06-01 08:33:18 +0200
commit11bcf4b22449d08b61617183c1951db98457653a (patch)
tree34d1983e1f1b5eb38d8c764ab9f2b406404b862e /libbb/lineedit.c
parent39a04f71ca8ccf81de2cdbd538df519cf34ef2e6 (diff)
downloadbusybox-11bcf4b22449d08b61617183c1951db98457653a.zip
busybox-11bcf4b22449d08b61617183c1951db98457653a.tar.gz
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.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 18664b8..8a2ea79 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -992,7 +992,7 @@ static void showfiles(void)
/* find the longest file name - use that as the column width */
for (row = 0; row < nrows; row++) {
- l = unicode_strlen(matches[row]);
+ l = unicode_strwidth(matches[row]);
if (column_width < l)
column_width = l;
}
@@ -1012,10 +1012,13 @@ static void showfiles(void)
for (nc = 1; nc < ncols && n+nrows < nfiles; n += nrows, nc++) {
printf("%s%-*s", matches[n],
- (int)(column_width - unicode_strlen(matches[n])), ""
+ (int)(column_width - unicode_strwidth(matches[n])), ""
);
}
- puts(matches[n]);
+ if (ENABLE_UNICODE_SUPPORT)
+ puts(printable_string(NULL, matches[n]));
+ else
+ puts(matches[n]);
}
}