]> granicus.if.org Git - cgit/commitdiff
ssdiff: correctly manage tab expansion
authorJulius Plenz <plenz@cis.fu-berlin.de>
Thu, 15 Nov 2012 16:35:06 +0000 (17:35 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Fri, 1 Feb 2013 12:46:47 +0000 (13:46 +0100)
Previously, replace_tabs("foo\tbar") would become "        foobar".

Signed-off-by: Julius Plenz <plenz@cis.fu-berlin.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
ui-ssdiff.c

index 71087799f5759bf48a0f45aea7ad8606c073c07a..3d3dad6806b5e43b1e8f3426f6f4513e3783d31f 100644 (file)
@@ -138,9 +138,8 @@ static char *replace_tabs(char *line)
                        strcat(result, prev_buf);
                        break;
                } else {
-                       strcat(result, " ");
-                       strncat(result, spaces, 8 - (strlen(result) % 8));
                        strncat(result, prev_buf, cur_buf - prev_buf);
+                       strncat(result, spaces, 8 - (strlen(result) % 8));
                }
                prev_buf = cur_buf + 1;
        }