1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:14:39 -07:00

godoc: don't select line numbers in orange

Previously a selection of text that spanned multiple lines would
include the line number as part of the orange highlight. This is
misleading (the line numbers aren't copied when you highlight the
text with your mouse) and a little ugly.

I had to move the tab character inside the <span class="ln"> block,
otherwise the orange highlight goes right up to the number, which is
off-putting and means the orange highlights don't line up vertically.

Before: https://monosnap.com/file/F9L166Zxxnf3ev74Z3JoJT0xz0nYLn.png
After: https://monosnap.com/file/6jfeFBG6tzhy3ZErqYWn6BfZ4fyk1R.png

Fixes golang/go#18561

Change-Id: I312d30ce01071850f8724246c54ce2d7259619d2
Reviewed-on: https://go-review.googlesource.com/34924
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Kevin Burke 2017-01-07 12:01:25 -08:00 committed by Brad Fitzpatrick
parent 354f9f8b43
commit b54fdb7e52
3 changed files with 3 additions and 1 deletions

View File

@ -594,7 +594,7 @@ func formatGoSource(buf *bytes.Buffer, text []byte, links []analysis.Link, patte
// linkWriter, so we have to add line spans as another pass.
n := 1
for _, line := range bytes.Split(buf.Bytes(), []byte("\n")) {
fmt.Fprintf(saved, "<span id=\"L%d\" class=\"ln\">%6d</span>\t", n, n)
fmt.Fprintf(saved, "<span id=\"L%d\" class=\"ln\">%6d\t</span>", n, n)
n++
saved.Write(line)
saved.WriteByte('\n')

View File

@ -2873,6 +2873,7 @@ pre .selection-comment {
}
pre .ln {
color: #999;
background: #efefef;
}
.ln {
-webkit-user-select: none;

View File

@ -29,6 +29,7 @@ pre .selection-comment {
}
pre .ln {
color: #999;
background: #efefef;
}
.ln {
-webkit-user-select: none;