Line numbers are no longer selectable by default, easing copy+paste of code snippets.
[gitweb-sgk] / gitweb.cgi
index 56881e1..c24d40b 100755 (executable)
@@ -6411,9 +6411,9 @@ sub git_search_files {
                                $ltext = esc_html($ltext, -nbsp=>1);
                        }
                        print "<div class=\"pre\">" .
                                $ltext = esc_html($ltext, -nbsp=>1);
                        }
                        print "<div class=\"pre\">" .
-                               $cgi->a({-href => $file_href.'#l'.$lno,
-                                       -class => "linenr"}, sprintf('%4i', $lno)) .
-                               ' ' .  $ltext . "</div>\n";
+                               "<a href=\"" . $file_href.'#l'.$lno . "\" " .
+                               "class=\"linenr\" unselectable-linenr=\"" . sprintf('%4i', $lno) . " \">" .
+                               "</a>" .  $ltext . "</div>\n";
                }
        }
        if ($lastfile) {
                }
        }
        if ($lastfile) {
@@ -7208,7 +7208,7 @@ sub git_blob {
                        chomp $line;
                        $nr++;
                        $line = untabify($line);
                        chomp $line;
                        $nr++;
                        $line = untabify($line);
-                       printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr">%4i</a> %s</div>\n!,
+                       printf qq!<div class="pre"><a id="l%i" href="%s#l%i" class="linenr" unselectable-linenr="%4i "></a>%s</div>\n!,
                               $nr, esc_attr(href(-replay => 1)), $nr, $nr,
                               $highlight ? sanitize($line) : esc_html($line, -nbsp=>1);
                }
                               $nr, esc_attr(href(-replay => 1)), $nr, $nr,
                               $highlight ? sanitize($line) : esc_html($line, -nbsp=>1);
                }