author | Lars Hjemli <hjemli@gmail.com> | 2009-01-27 19:21:56 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-01-27 19:21:56 (UTC) |
commit | 1fdde95a5a169ad2240460b1d3f25bae606527f5 (patch) (unidiff) | |
tree | 6db50f36114ee1bc29cf39dedc05e0106b886b8a | |
parent | 7710178e45dee61e85ea77c4221309ce8c086f95 (diff) | |
parent | a90e2aa4e1bd5c3a9657ce7d675943f4a265cc9f (diff) | |
download | cgit-1fdde95a5a169ad2240460b1d3f25bae606527f5.zip cgit-1fdde95a5a169ad2240460b1d3f25bae606527f5.tar.gz cgit-1fdde95a5a169ad2240460b1d3f25bae606527f5.tar.bz2 |
Merge branch 'og/tree-view-selection'
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.css | 27 | ||||
-rwxr-xr-x | tests/t0104-tree.sh | 4 | ||||
-rw-r--r-- | ui-tree.c | 31 |
3 files changed, 34 insertions, 28 deletions
@@ -238,15 +238,22 @@ table.blob { | |||
238 | 238 | ||
239 | table.blob td.no { | 239 | table.blob td.lines { |
240 | border-right: solid 1px black; | 240 | margin: 0; padding: 0; |
241 | vertical-align: top; | ||
241 | color: black; | 242 | color: black; |
243 | } | ||
244 | |||
245 | table.blob td.linenumbers { | ||
246 | margin: 0; padding: 0; | ||
247 | vertical-align: top; | ||
248 | border-right: 1px solid gray; | ||
242 | background-color: #eee; | 249 | background-color: #eee; |
243 | text-align: right; | ||
244 | } | 250 | } |
245 | 251 | ||
246 | table.blob td.no a { | 252 | table.blob pre { |
247 | color: black; | 253 | padding: 0; margin: 0; |
248 | } | 254 | } |
249 | 255 | ||
250 | table.blob td.no a:hover { | 256 | table.blob a.no { |
251 | color: black; | 257 | color: gray; |
258 | text-align: right; | ||
252 | text-decoration: none; | 259 | text-decoration: none; |
@@ -254,6 +261,4 @@ table.blob td.no a:hover { | |||
254 | 261 | ||
255 | table.blob td.txt { | 262 | table.blob a.no a:hover { |
256 | white-space: pre; | 263 | color: black; |
257 | font-family: monospace; | ||
258 | padding-left: 0.5em; | ||
259 | } | 264 | } |
diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index 33f4eb0..2ce1251 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh | |||
@@ -13,3 +13,3 @@ run_test 'generate bar/tree/file-50' 'cgit_url "bar/tree/file-50" >trash/tmp' | |||
13 | run_test 'find line 1' ' | 13 | run_test 'find line 1' ' |
14 | grep -e "<a id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp | 14 | grep -e "<a class=.no. id=.n1. name=.n1. href=.#n1.>1</a>" trash/tmp |
15 | ' | 15 | ' |
@@ -17,3 +17,3 @@ run_test 'find line 1' ' | |||
17 | run_test 'no line 2' ' | 17 | run_test 'no line 2' ' |
18 | ! grep -e "<a id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp | 18 | ! grep -e "<a class=.no. id=.n2. name=.n2. href=.#n2.>2</a>" trash/tmp |
19 | ' | 19 | ' |
@@ -20,4 +20,4 @@ static void print_object(const unsigned char *sha1, char *path) | |||
20 | char *buf; | 20 | char *buf; |
21 | unsigned long size, lineno, start, idx; | 21 | unsigned long size, lineno, idx; |
22 | const char *linefmt = "<tr><td class='no'><a id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a></td><td class='txt'>"; | 22 | const char *numberfmt = "<a class='no' id='n%1$d' name='n%1$d' href='#n%1$d'>%1$d</a>\n"; |
23 | 23 | ||
@@ -40,15 +40,14 @@ static void print_object(const unsigned char *sha1, char *path) | |||
40 | curr_rev, path); | 40 | curr_rev, path); |
41 | htmlf(")<br/>blob: %s", sha1_to_hex(sha1)); | 41 | htmlf(")<br/>blob: %s\n", sha1_to_hex(sha1)); |
42 | 42 | ||
43 | html("<table summary='blob content' class='blob'>\n"); | 43 | html("<table summary='blob content' class='blob'>\n"); |
44 | html("<tr>\n"); | ||
45 | |||
46 | html("<td class='linenumbers'><pre>"); | ||
44 | idx = 0; | 47 | idx = 0; |
45 | start = 0; | ||
46 | lineno = 0; | 48 | lineno = 0; |
47 | while(idx < size) { | 49 | htmlf(numberfmt, ++lineno); |
50 | while(idx < size - 1) { // skip absolute last newline | ||
48 | if (buf[idx] == '\n') { | 51 | if (buf[idx] == '\n') { |
49 | buf[idx] = '\0'; | 52 | htmlf(numberfmt, ++lineno); |
50 | htmlf(linefmt, ++lineno); | ||
51 | html_txt(buf + start); | ||
52 | html("</td></tr>\n"); | ||
53 | start = idx + 1; | ||
54 | } | 53 | } |
@@ -56,7 +55,9 @@ static void print_object(const unsigned char *sha1, char *path) | |||
56 | } | 55 | } |
57 | if (start < idx) { | 56 | html("</pre></td>\n"); |
58 | htmlf(linefmt, ++lineno); | 57 | |
59 | html_txt(buf + start); | 58 | html("<td class='lines'><pre><code>"); |
60 | } | 59 | html_txt(buf); |
61 | html("</td></tr>\n"); | 60 | html("</code></pre></td>\n"); |
61 | |||
62 | html("</tr>\n"); | ||
62 | html("</table>\n"); | 63 | html("</table>\n"); |