From 1fdde95a5a169ad2240460b1d3f25bae606527f5 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Tue, 27 Jan 2009 19:21:56 +0000 Subject: Merge branch 'og/tree-view-selection' Signed-off-by: Lars Hjemli --- (limited to 'ui-tree.c') diff --git a/ui-tree.c b/ui-tree.c index 4b8e7a0..c26ba4c 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -18,8 +18,8 @@ static void print_object(const unsigned char *sha1, char *path) { enum object_type type; char *buf; - unsigned long size, lineno, start, idx; - const char *linefmt = "%1$d"; + unsigned long size, lineno, idx; + const char *numberfmt = "%1$d\n"; type = sha1_object_info(sha1, &size); if (type == OBJ_BAD) { @@ -38,27 +38,28 @@ static void print_object(const unsigned char *sha1, char *path) html(" ("); cgit_plain_link("plain", NULL, NULL, ctx.qry.head, curr_rev, path); - htmlf(")
blob: %s", sha1_to_hex(sha1)); + htmlf(")
blob: %s\n", sha1_to_hex(sha1)); html("\n"); + html("\n"); + + html("\n"); - start = idx + 1; + htmlf(numberfmt, ++lineno); } idx++; } - if (start < idx) { - htmlf(linefmt, ++lineno); - html_txt(buf + start); - } - html("\n"); + html("\n"); + + html("\n"); + + html("\n"); html("
");
 	idx = 0;
-	start = 0;
 	lineno = 0;
-	while(idx < size) {
+	htmlf(numberfmt, ++lineno);
+	while(idx < size - 1) { // skip absolute last newline
 		if (buf[idx] == '\n') {
-			buf[idx] = '\0';
-			htmlf(linefmt, ++lineno);
-			html_txt(buf + start);
-			html("
");
+	html_txt(buf);
+	html("
\n"); } -- cgit v0.9.0.2