Skip to content

Commit 6affdbe

Browse files
cernekeegitster
authored andcommitted
gitweb: highlight: replace tabs with spaces
Consider the following code fragment: /* * test */ vim ":set list" mode shows that the first character on each line is a tab: ^I/*$ ^I * test$ ^I */$ By default, the "highlight" program will retain the tabs in the HTML output: $ highlight --fragment --syntax c test.c <span class="hl com">/*</span> <span class="hl com"> * test</span> <span class="hl com"> */</span> vim list mode: ^I<span class="hl com">/*</span>$ <span class="hl com">^I * test</span>$ <span class="hl com">^I */</span>$ In gitweb, this winds up looking something like: 1 /* 2 * test 3 */ I tried both Firefox and Opera and saw the same behavior. The desired output is: 1 /* 2 * test 3 */ This can be accomplished by specifying "--replace-tabs=8" on the highlight command line. Signed-off-by: Kevin Cernekee <[email protected]> Acked-by: John 'Warthog9' Hawley <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1d679de commit 6affdbe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gitweb/gitweb.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3468,7 +3468,7 @@ sub run_highlighter {
34683468
close $fd;
34693469
open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
34703470
quote_command($highlight_bin).
3471-
" --fragment --syntax $syntax |"
3471+
" --replace-tabs=8 --fragment --syntax $syntax |"
34723472
or die_error(500, "Couldn't open file or run syntax highlighter");
34733473
return $fd;
34743474
}

0 commit comments

Comments
 (0)