while (*ptr) {
unsigned n;
- unsigned len;
+ unsigned len = 0;
while (*ptr == ' ') {
- column++;
ptr++;
+ len++;
}
+ column += len;
if (*ptr == '\t') {
column += tab_size - (column % tab_size);
ptr++;
}
n = column / tab_size;
- column = column % tab_size;
- while (n--)
- putchar('\t');
+ if (n) {
+ len = column = column % tab_size;
+ while (n--)
+ putchar('\t');
+ }
if ((opt & OPT_INITIAL) && ptr != line) {
- printf("%*s%s", column, "", ptr);
+ printf("%*s%s", len, "", ptr);
break;
}
n = strcspn(ptr, "\t ");
- printf("%*s%.*s", column, "", n, ptr);
+ printf("%*s%.*s", len, "", n, ptr);
# if ENABLE_FEATURE_ASSUME_UNICODE
{
char c;
testing "unexpand case 7" "unexpand" \
"123\t 45678\n" "" "123 \t 45678\n" \
+testing "unexpand case 8" "unexpand" \
+ "a b\n" "" "a b\n" \
+
testing "unexpand with unicode characher 0x394" "unexpand" \
"1ΔΔΔ5\t99999\n" "" "1ΔΔΔ5 99999\n" \