X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=ws.c;h=7302f8f5a2cd450771aefcba0a385a90121ba0cf;hb=5501bf854ce6a3847ef0de6f6aa63f6b93e82b67;hp=d7b8c33f14195ba7ebe86bdbca2fea8f1b22ad37;hpb=a26df4cd2fdad7451d4ec99f8a339b9e107a4728;p=git.git diff --git a/ws.c b/ws.c index d7b8c33f1..7302f8f5a 100644 --- a/ws.c +++ b/ws.c @@ -174,8 +174,11 @@ static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule, } } + if (trailing_whitespace == -1) + trailing_whitespace = len; + /* Check indentation */ - for (i = 0; i < len; i++) { + for (i = 0; i < trailing_whitespace; i++) { if (line[i] == ' ') continue; if (line[i] != '\t') @@ -218,8 +221,6 @@ static unsigned ws_check_emit_1(const char *line, int len, unsigned ws_rule, * Now the rest of the line starts at "written". * The non-highlighted part ends at "trailing_whitespace". */ - if (trailing_whitespace == -1) - trailing_whitespace = len; /* Emit non-highlighted (middle) segment. */ if (trailing_whitespace - written > 0) {