From: Aaron Taylor Date: Thu, 17 Jun 2021 23:09:54 +0000 (-0700) Subject: Line numbers are no longer selectable by default, easing copy+paste of code snippets. X-Git-Url: http://git.subgeniuskitty.com/gitweb-sgk/.git/commitdiff_plain/4dcd50cd53223f7c8a40aa231af23995abe1c3a1 Line numbers are no longer selectable by default, easing copy+paste of code snippets. --- diff --git a/gitweb.cgi b/gitweb.cgi index 56881e1..c24d40b 100755 --- a/gitweb.cgi +++ b/gitweb.cgi @@ -6411,9 +6411,9 @@ sub git_search_files { $ltext = esc_html($ltext, -nbsp=>1); } print "
" . - $cgi->a({-href => $file_href.'#l'.$lno, - -class => "linenr"}, sprintf('%4i', $lno)) . - ' ' . $ltext . "
\n"; + "" . + "" . $ltext . "\n"; } } if ($lastfile) { @@ -7208,7 +7208,7 @@ sub git_blob { chomp $line; $nr++; $line = untabify($line); - printf qq!
%4i %s
\n!, + printf qq!
%s
\n!, $nr, esc_attr(href(-replay => 1)), $nr, $nr, $highlight ? sanitize($line) : esc_html($line, -nbsp=>1); } diff --git a/static/gitweb.css b/static/gitweb.css index 44ce42b..8e93114 100644 --- a/static/gitweb.css +++ b/static/gitweb.css @@ -782,3 +782,9 @@ td.pre, div.pre, div.diff { .kwb { color:#6b3099; } .kwc { color:#d4663d; } .kwd { color:#2928ff; } + +/* Unselectable line numbers for easier copy+paste. */ + +[unselectable-linenr]::before { + content: attr(unselectable-linenr); +}