[PATCH v2] bugfix: make ss-diff correctly handle tab expansion

Julius Plenz plenz at cis.fu-berlin.de
Thu Nov 15 17:35:06 CET 2012


Previously, replace_tabs("foo\tbar") would become "        foobar".

Signed-off-by: Julius Plenz <plenz at cis.fu-berlin.de>
---
 ui-ssdiff.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/ui-ssdiff.c b/ui-ssdiff.c
index c54f7a0..6fe2268 100644
--- a/ui-ssdiff.c
+++ b/ui-ssdiff.c
@@ -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;
 	}
-- 
1.7.12.3-zedat





More information about the CGit mailing list