"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
gotwebd: attempt to allow copy-pasting from BLOB pages
To:
gameoftrees@openbsd.org
Date:
Tue, 30 Jan 2024 11:22:00 +0100

Download raw body.

Thread
The idea is to allow to copy-paste code from the BLOB page in other
applications.  I'm doing this by making the line number not
user-selectable: this currently causes a 'bug' in firefox which inserts
a double line ending, but chromium behaves fine.  Hopefully firefox will
be fixed eventually.

I'm also moving the space inside the link, so it's not copied.  This is
only noticeable in text browsers.  I can't just remove the space between
the link and line and faking it in CSS because it would render bad on
text browsers.

I have this running on my instance.

diff /home/op/w/got
commit - 08fe932a5bc4e17bb7d4e71aa3d15c4f460b553e
path + /home/op/w/got
blob - 1915d9ab20a65b95284f0e0df4b2b1bdf408bc78
file + gotwebd/files/htdocs/gotwebd/gotweb.css
--- gotwebd/files/htdocs/gotwebd/gotweb.css
+++ gotwebd/files/htdocs/gotwebd/gotweb.css
@@ -329,6 +329,7 @@ header.subtitle h2 {
 	text-align: right;
 	width: 60px;
 	padding-right: 20px;
+	user-select: none;
 }
 .blame_code, .blob_code {
 	/* fixes the width of the first tab */
blob - 8731fea2ba676254561d5779cdc1aa5c0d411876
file + gotwebd/pages.tmpl
--- gotwebd/pages.tmpl
+++ gotwebd/pages.tmpl
@@ -637,8 +637,7 @@ nextsep(char *s, char **t)
 		return -1;
 !}
 <div class="blob_line" id="line{{ lineno }}">
-  <a href="#line{{ lineno }}">{{ lineno }}</a>
-  {{" "}}
+  <a href="#line{{ lineno }}">{{ lineno }}{{" "}}</a>
   <span class="blob_code">{{ line }}</span>
 </div>
 {{ end }}