From 8de86212516cf605c3e2e68f3f93699d0a1f0093 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 22 Oct 2026 18:56:56 -1000 Subject: Keep the code in step with its line numbers The stylesheet overhaul in 722524b gave the pre of the tree and blame pages the site's monospace font but left the code element inside it on the browser's own, Courier in Safari and DejaVu Sans Mono on a typical Linux desktop. A line box holds both fonts on one baseline, so where their ascent and descent differ each code line comes out a little taller than its number. By the end of a 2,000 line file the code sat 45 lines low with Courier and 109 with DejaVu Sans Mono. --- tests/t0104-tree.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index b48c394..fefff4a 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -22,6 +22,15 @@ test_expect_success 'no line 2' ' ! grep "2" tmp ' +# The numbers and the code are two columns of text that a browser keeps in +# step only while both are set in one font. Only a browser shows the drift, +# so this checks the rule that prevents it. +test_expect_success 'the code is set in the font of its line numbers' ' + sed -n "/^div#cgit table.blob code {/,/^}/p" \ + "$TEST_OUTPUT_DIRECTORY/../assets/cgit.css" >rule && + grep "^ font: inherit;$" rule +' + test_expect_success 'generate foo+bar/tree' 'cgit_url "foo%2bbar/tree" >tmp' test_expect_success 'verify a+b link' ' -- cgit 2.12.1