Tue Sep 20 07:01:50 UTC 2005 Alberto Bertogli * Replace tabs with spaces for nicer output. Tabs need to be replaced with spaces to avoid problems displaying lines that begin with tabs. This patch implements a very simple function to do so, and modifices print_blob() to use it. diff -rN -u old-darcsweb/darcsweb.cgi new-darcsweb/darcsweb.cgi --- old-darcsweb/darcsweb.cgi 2015-10-21 14:57:24.000000000 +0000 +++ new-darcsweb/darcsweb.cgi 2015-10-21 14:57:25.000000000 +0000 @@ -139,6 +139,16 @@ s = s[:max - 4] + ' ...' return s +def replace_tabs(s): + pos = s.find("\t") + while pos != -1: + count = 8 - (pos % 8) + if count: + spaces = ' ' * count + s = s.replace('\t', spaces, 1) + pos = s.find("\t") + return s + def fperms(fname): m = os.stat(fname)[stat.ST_MODE] m = m & 0777 @@ -941,6 +951,7 @@ l = fixu8(escape(l)) if l and l[-1] == '\n': l = l[:-1] + l = replace_tabs(l) print """\
\