From 5f12e45fe3338095916a444ff106dd9fc9991d84 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sun, 13 Sep 2009 20:01:52 +0000 Subject: Merge branch 'fp/linenumbers' --- (limited to 'ui-tree.c') diff --git a/ui-tree.c b/ui-tree.c index c608754..f53ab64 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -22,8 +22,28 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size) "%1$d\n"; html("\n"); + + if (ctx.cfg.enable_tree_linenumbers) { + html("\n"); + } + else { + html("\n"); + } + if (ctx.repo->source_filter) { - html("\n"); html("
");
+		idx = 0;
+		lineno = 0;
+	
+		if (size) {
+			htmlf(numberfmt, ++lineno);
+			while(idx < size - 1) { // skip absolute last newline
+				if (buf[idx] == '\n')
+					htmlf(numberfmt, ++lineno);
+				idx++;
+			}
+		}
+		html("
");
+		html("
");
 		ctx.repo->source_filter->argv[1] = xstrdup(name);
 		cgit_open_filter(ctx.repo->source_filter);
 		write(STDOUT_FILENO, buf, size);
@@ -32,19 +52,6 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
 		return;
 	}
 
-	html("
");
-	idx = 0;
-	lineno = 0;
-
-	if (size) {
-		htmlf(numberfmt, ++lineno);
-		while(idx < size - 1) { // skip absolute last newline
-			if (buf[idx] == '\n')
-				htmlf(numberfmt, ++lineno);
-			idx++;
-		}
-	}
-	html("
");
 	html_txt(buf);
 	html("
\n"); -- cgit v0.9.0.2