From b54fdb7e522e703b17aad527c6cbfd193ffade55 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Sat, 7 Jan 2017 12:01:25 -0800 Subject: [PATCH] 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 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 TryBot-Result: Gobot Gobot Reviewed-by: Matt Layher Reviewed-by: Brad Fitzpatrick --- godoc/server.go | 2 +- godoc/static/static.go | 1 + godoc/static/style.css | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/godoc/server.go b/godoc/server.go index 18f110a3..294610ed 100644 --- a/godoc/server.go +++ b/godoc/server.go @@ -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, "%6d\t", n, n) + fmt.Fprintf(saved, "%6d\t", n, n) n++ saved.Write(line) saved.WriteByte('\n') diff --git a/godoc/static/static.go b/godoc/static/static.go index 70a4d931..a47a7fd0 100644 --- a/godoc/static/static.go +++ b/godoc/static/static.go @@ -2873,6 +2873,7 @@ pre .selection-comment { } pre .ln { color: #999; + background: #efefef; } .ln { -webkit-user-select: none; diff --git a/godoc/static/style.css b/godoc/static/style.css index 78c539e9..025327b8 100644 --- a/godoc/static/style.css +++ b/godoc/static/style.css @@ -29,6 +29,7 @@ pre .selection-comment { } pre .ln { color: #999; + background: #efefef; } .ln { -webkit-user-select: none;