ZhoubaWiki:GitWebTabs

From ZhoubaWiki
Jump to: navigation, search
 gitweb/gitweb.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a85e2f6..ef92a4f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1465,9 +1465,11 @@ sub unquote {
 # escape tabs (convert tabs to spaces)
 sub untabify {
  my $line = shift;
+ my $tabwidth = git_get_project_config('tabwidth', '--int');
+ $tabwidth = 8 if ($tabwidth <= 0);
 
  while ((my $pos = index($line, "\t")) != -1) {
- if (my $count = (8 - ($pos % 8))) {
+ if (my $count = ($tabwidth - ($pos % $tabwidth))) {
  my $spaces = ' ' x $count;
  $line =~ s/\t/$spaces/;
  }
-- 
1.7.0.4