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>
This commit is contained in:
committed by
Denys Vlasenko
parent
39a04f71ca
commit
11bcf4b224
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user