Fossil SCM

Fix (URL-decode) a hyperlink that gets into clipboard when user selects a line of code (or a range of lines) and clicks "copy-to-clipboard". This affects /file, /artifact and /whatis pages. This fix may be somewhat suboptimal or incomplete: it may be worth investigating why some submenu's links are mangled on a server's side and fix it there (hint: perhaps %T and %h formatting does not play well with style_submenu_*() family of functions, see also check-in [b982c00150] and post [forum:b8ea664a57]).

george 2021-03-31 22:53 trunk
Commit 898151877f9281100047ef891b53fadb8d88021de94921aa4e6907ff75e8534c
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -17,18 +17,18 @@
1717
}
1818
}
1919
if(!tbl) return /* no matching elements */;
2020
const F = window.fossil, D = F.dom;
2121
const tdLn = tbl.querySelector('td.line-numbers');
22
- const lineState = {
23
- urlArgs: (window.location.search||'?')
22
+ const urlArgsRaw = (window.location.search||'?')
2423
.replace(/&?\budc=[^&]*/,'') /* "update display prefs cookie" */
2524
.replace(/&?\bln=[^&]*/,'') /* inbound line number/range */
26
- .replace('?&','?'),
27
- start: 0, end: 0
28
- };
29
-
25
+ .replace('?&','?');
26
+ var urlArgsDecoded = urlArgsRaw;
27
+ try{urlArgsDecoded = decodeURIComponent(urlArgsRaw);}
28
+ catch{}
29
+ const lineState = { urlArgs: urlArgsDecoded, start: 0, end: 0 };
3030
const lineTip = new F.PopupWidget({
3131
style: {
3232
cursor: 'pointer'
3333
},
3434
refresh: function(){
3535
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -17,18 +17,18 @@
17 }
18 }
19 if(!tbl) return /* no matching elements */;
20 const F = window.fossil, D = F.dom;
21 const tdLn = tbl.querySelector('td.line-numbers');
22 const lineState = {
23 urlArgs: (window.location.search||'?')
24 .replace(/&?\budc=[^&]*/,'') /* "update display prefs cookie" */
25 .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */
26 .replace('?&','?'),
27 start: 0, end: 0
28 };
29
 
30 const lineTip = new F.PopupWidget({
31 style: {
32 cursor: 'pointer'
33 },
34 refresh: function(){
35
--- src/fossil.numbered-lines.js
+++ src/fossil.numbered-lines.js
@@ -17,18 +17,18 @@
17 }
18 }
19 if(!tbl) return /* no matching elements */;
20 const F = window.fossil, D = F.dom;
21 const tdLn = tbl.querySelector('td.line-numbers');
22 const urlArgsRaw = (window.location.search||'?')
 
23 .replace(/&?\budc=[^&]*/,'') /* "update display prefs cookie" */
24 .replace(/&?\bln=[^&]*/,'') /* inbound line number/range */
25 .replace('?&','?');
26 var urlArgsDecoded = urlArgsRaw;
27 try{urlArgsDecoded = decodeURIComponent(urlArgsRaw);}
28 catch{}
29 const lineState = { urlArgs: urlArgsDecoded, start: 0, end: 0 };
30 const lineTip = new F.PopupWidget({
31 style: {
32 cursor: 'pointer'
33 },
34 refresh: function(){
35

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button