Fossil SCM

Apply the "hash-digits" setting to limit the length of hash prefixes displayed on tooltips.

florian 2019-05-29 14:14 tooltip-copyhash
Commit 90e4f5ae9f8f4e455d1650adb3362e9a372e52ed1117db551cbdcd97e9a615c1
--- src/graph.js
+++ src/graph.js
@@ -19,10 +19,11 @@
1919
** "scrollToSelect": BOOLEAN, // Scroll to selection on first render
2020
** "nrail": INTEGER, // Number of vertical "rails"
2121
** "baseUrl": TEXT, // Top-level URL
2222
** "dwellTimeout": INTEGER, // Tooltip show delay in milliseconds
2323
** "closeTimeout": INTEGER, // Tooltip close delay in milliseconds
24
+** "digitHuman": INTEGER, // Limit of tooltip hashes ("hash-digits")
2425
** "rowinfo": ROWINFO-ARRAY }
2526
**
2627
** The rowinfo field is an array of structures, one per entry in the timeline,
2728
** where each structure has the following fields:
2829
**
@@ -97,10 +98,11 @@
9798
9899
/* State information for the tooltip popup and its timers */
99100
window.tooltipInfo = {
100101
dwellTimeout: 250, /* The tooltip dwell timeout. */
101102
closeTimeout: 3000, /* The tooltip close timeout. */
103
+ digitHuman: 10, /* Limit of tooltip hashes ("hash-digits"). */
102104
idTimer: 0, /* The tooltip dwell timer id. */
103105
idTimerClose: 0, /* The tooltip close timer id. */
104106
ixHover: -1, /* The id of the element with the mouse. */
105107
ixActive: -1, /* The id of the element with the tooltip. */
106108
nodeHover: null, /* Graph node under mouse when ixHover==-2 */
@@ -141,10 +143,11 @@
141143
function TimelineGraph(tx){
142144
var topObj = document.getElementById("timelineTable"+tx.iTableId);
143145
amendCss(tx.circleNodes, tx.showArrowheads);
144146
tooltipInfo.dwellTimeout = tx.dwellTimeout
145147
tooltipInfo.closeTimeout = tx.closeTimeout
148
+ tooltipInfo.digitHuman = tx.digitHuman
146149
topObj.onclick = clickOnGraph
147150
topObj.ondblclick = dblclickOnGraph
148151
topObj.onmousemove = function(e) {
149152
var ix = findTxIndex(e);
150153
topObj.style.cursor = (ix<0) ? "" : "pointer"
@@ -594,10 +597,11 @@
594597
var ix = -1
595598
if( tooltipInfo.ixHover==-2 ){
596599
ix = parseInt(tooltipInfo.nodeHover.id.match(/\d+$/)[0],10)-tx.iTopRow
597600
var h = tx.rowinfo[ix].h
598601
var dest = tx.baseUrl + "/info/" + h
602
+ h = h.slice(0,tooltipInfo.digitHuman); // Assume single-byte characters.
599603
if( tx.fileDiff ){
600604
html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
601605
}else{
602606
html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
603607
}
604608
--- src/graph.js
+++ src/graph.js
@@ -19,10 +19,11 @@
19 ** "scrollToSelect": BOOLEAN, // Scroll to selection on first render
20 ** "nrail": INTEGER, // Number of vertical "rails"
21 ** "baseUrl": TEXT, // Top-level URL
22 ** "dwellTimeout": INTEGER, // Tooltip show delay in milliseconds
23 ** "closeTimeout": INTEGER, // Tooltip close delay in milliseconds
 
24 ** "rowinfo": ROWINFO-ARRAY }
25 **
26 ** The rowinfo field is an array of structures, one per entry in the timeline,
27 ** where each structure has the following fields:
28 **
@@ -97,10 +98,11 @@
97
98 /* State information for the tooltip popup and its timers */
99 window.tooltipInfo = {
100 dwellTimeout: 250, /* The tooltip dwell timeout. */
101 closeTimeout: 3000, /* The tooltip close timeout. */
 
102 idTimer: 0, /* The tooltip dwell timer id. */
103 idTimerClose: 0, /* The tooltip close timer id. */
104 ixHover: -1, /* The id of the element with the mouse. */
105 ixActive: -1, /* The id of the element with the tooltip. */
106 nodeHover: null, /* Graph node under mouse when ixHover==-2 */
@@ -141,10 +143,11 @@
141 function TimelineGraph(tx){
142 var topObj = document.getElementById("timelineTable"+tx.iTableId);
143 amendCss(tx.circleNodes, tx.showArrowheads);
144 tooltipInfo.dwellTimeout = tx.dwellTimeout
145 tooltipInfo.closeTimeout = tx.closeTimeout
 
146 topObj.onclick = clickOnGraph
147 topObj.ondblclick = dblclickOnGraph
148 topObj.onmousemove = function(e) {
149 var ix = findTxIndex(e);
150 topObj.style.cursor = (ix<0) ? "" : "pointer"
@@ -594,10 +597,11 @@
594 var ix = -1
595 if( tooltipInfo.ixHover==-2 ){
596 ix = parseInt(tooltipInfo.nodeHover.id.match(/\d+$/)[0],10)-tx.iTopRow
597 var h = tx.rowinfo[ix].h
598 var dest = tx.baseUrl + "/info/" + h
 
599 if( tx.fileDiff ){
600 html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
601 }else{
602 html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
603 }
604
--- src/graph.js
+++ src/graph.js
@@ -19,10 +19,11 @@
19 ** "scrollToSelect": BOOLEAN, // Scroll to selection on first render
20 ** "nrail": INTEGER, // Number of vertical "rails"
21 ** "baseUrl": TEXT, // Top-level URL
22 ** "dwellTimeout": INTEGER, // Tooltip show delay in milliseconds
23 ** "closeTimeout": INTEGER, // Tooltip close delay in milliseconds
24 ** "digitHuman": INTEGER, // Limit of tooltip hashes ("hash-digits")
25 ** "rowinfo": ROWINFO-ARRAY }
26 **
27 ** The rowinfo field is an array of structures, one per entry in the timeline,
28 ** where each structure has the following fields:
29 **
@@ -97,10 +98,11 @@
98
99 /* State information for the tooltip popup and its timers */
100 window.tooltipInfo = {
101 dwellTimeout: 250, /* The tooltip dwell timeout. */
102 closeTimeout: 3000, /* The tooltip close timeout. */
103 digitHuman: 10, /* Limit of tooltip hashes ("hash-digits"). */
104 idTimer: 0, /* The tooltip dwell timer id. */
105 idTimerClose: 0, /* The tooltip close timer id. */
106 ixHover: -1, /* The id of the element with the mouse. */
107 ixActive: -1, /* The id of the element with the tooltip. */
108 nodeHover: null, /* Graph node under mouse when ixHover==-2 */
@@ -141,10 +143,11 @@
143 function TimelineGraph(tx){
144 var topObj = document.getElementById("timelineTable"+tx.iTableId);
145 amendCss(tx.circleNodes, tx.showArrowheads);
146 tooltipInfo.dwellTimeout = tx.dwellTimeout
147 tooltipInfo.closeTimeout = tx.closeTimeout
148 tooltipInfo.digitHuman = tx.digitHuman
149 topObj.onclick = clickOnGraph
150 topObj.ondblclick = dblclickOnGraph
151 topObj.onmousemove = function(e) {
152 var ix = findTxIndex(e);
153 topObj.style.cursor = (ix<0) ? "" : "pointer"
@@ -594,10 +597,11 @@
597 var ix = -1
598 if( tooltipInfo.ixHover==-2 ){
599 ix = parseInt(tooltipInfo.nodeHover.id.match(/\d+$/)[0],10)-tx.iTopRow
600 var h = tx.rowinfo[ix].h
601 var dest = tx.baseUrl + "/info/" + h
602 h = h.slice(0,tooltipInfo.digitHuman); // Assume single-byte characters.
603 if( tx.fileDiff ){
604 html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
605 }else{
606 html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
607 }
608
--- src/timeline.c
+++ src/timeline.c
@@ -832,10 +832,11 @@
832832
int fileDiff; /* True for file diff. False for check-in diff */
833833
int omitDescenders; /* True to omit descenders */
834834
int scrollToSelect; /* True to scroll to the selection */
835835
int dwellTimeout; /* Milliseconds to wait for tooltips to show */
836836
int closeTimeout; /* Milliseconds to wait for tooltips to close */
837
+ int nDigitHuman; /* The "hash-digits" limit for tooltip hash prefixes */
837838
u8 *aiMap; /* The rail map */
838839
839840
iRailPitch = atoi(PD("railpitch","0"));
840841
showArrowheads = skin_detail_boolean("timeline-arrowheads");
841842
circleNodes = skin_detail_boolean("timeline-circle-nodes");
@@ -844,10 +845,15 @@
844845
omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
845846
fileDiff = (tmFlags & TIMELINE_FILEDIFF)!=0;
846847
scrollToSelect = (tmFlags & TIMELINE_NOSCROLL)==0;
847848
dwellTimeout = atoi(db_get("timeline-dwelltime","100"));
848849
closeTimeout = atoi(db_get("timeline-closetime","250"));
850
+/* Preprocessor definitions copied from src\printf.c. */
851
+#ifndef FOSSIL_HASH_DIGITS
852
+# define FOSSIL_HASH_DIGITS 10
853
+#endif
854
+ nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS);
849855
@ <script id='timeline-data-%d(iTableId)' type='application/json'>{
850856
@ "iTableId": %d(iTableId),
851857
@ "circleNodes": %d(circleNodes),
852858
@ "showArrowheads": %d(showArrowheads),
853859
@ "iRailPitch": %d(iRailPitch),
@@ -859,10 +865,11 @@
859865
@ "scrollToSelect": %d(scrollToSelect),
860866
@ "nrail": %d(pGraph->mxRail+1),
861867
@ "baseUrl": "%R",
862868
@ "dwellTimeout": %d(dwellTimeout),
863869
@ "closeTimeout": %d(closeTimeout),
870
+ @ "digitHuman": %d(nDigitHuman),
864871
@ "bottomRowId": "btm-%d(iTableId)",
865872
if( pGraph->nRow==0 ){
866873
@ "rowinfo": null
867874
}else{
868875
@ "rowinfo": [
869876
--- src/timeline.c
+++ src/timeline.c
@@ -832,10 +832,11 @@
832 int fileDiff; /* True for file diff. False for check-in diff */
833 int omitDescenders; /* True to omit descenders */
834 int scrollToSelect; /* True to scroll to the selection */
835 int dwellTimeout; /* Milliseconds to wait for tooltips to show */
836 int closeTimeout; /* Milliseconds to wait for tooltips to close */
 
837 u8 *aiMap; /* The rail map */
838
839 iRailPitch = atoi(PD("railpitch","0"));
840 showArrowheads = skin_detail_boolean("timeline-arrowheads");
841 circleNodes = skin_detail_boolean("timeline-circle-nodes");
@@ -844,10 +845,15 @@
844 omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
845 fileDiff = (tmFlags & TIMELINE_FILEDIFF)!=0;
846 scrollToSelect = (tmFlags & TIMELINE_NOSCROLL)==0;
847 dwellTimeout = atoi(db_get("timeline-dwelltime","100"));
848 closeTimeout = atoi(db_get("timeline-closetime","250"));
 
 
 
 
 
849 @ <script id='timeline-data-%d(iTableId)' type='application/json'>{
850 @ "iTableId": %d(iTableId),
851 @ "circleNodes": %d(circleNodes),
852 @ "showArrowheads": %d(showArrowheads),
853 @ "iRailPitch": %d(iRailPitch),
@@ -859,10 +865,11 @@
859 @ "scrollToSelect": %d(scrollToSelect),
860 @ "nrail": %d(pGraph->mxRail+1),
861 @ "baseUrl": "%R",
862 @ "dwellTimeout": %d(dwellTimeout),
863 @ "closeTimeout": %d(closeTimeout),
 
864 @ "bottomRowId": "btm-%d(iTableId)",
865 if( pGraph->nRow==0 ){
866 @ "rowinfo": null
867 }else{
868 @ "rowinfo": [
869
--- src/timeline.c
+++ src/timeline.c
@@ -832,10 +832,11 @@
832 int fileDiff; /* True for file diff. False for check-in diff */
833 int omitDescenders; /* True to omit descenders */
834 int scrollToSelect; /* True to scroll to the selection */
835 int dwellTimeout; /* Milliseconds to wait for tooltips to show */
836 int closeTimeout; /* Milliseconds to wait for tooltips to close */
837 int nDigitHuman; /* The "hash-digits" limit for tooltip hash prefixes */
838 u8 *aiMap; /* The rail map */
839
840 iRailPitch = atoi(PD("railpitch","0"));
841 showArrowheads = skin_detail_boolean("timeline-arrowheads");
842 circleNodes = skin_detail_boolean("timeline-circle-nodes");
@@ -844,10 +845,15 @@
845 omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
846 fileDiff = (tmFlags & TIMELINE_FILEDIFF)!=0;
847 scrollToSelect = (tmFlags & TIMELINE_NOSCROLL)==0;
848 dwellTimeout = atoi(db_get("timeline-dwelltime","100"));
849 closeTimeout = atoi(db_get("timeline-closetime","250"));
850 /* Preprocessor definitions copied from src\printf.c. */
851 #ifndef FOSSIL_HASH_DIGITS
852 # define FOSSIL_HASH_DIGITS 10
853 #endif
854 nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS);
855 @ <script id='timeline-data-%d(iTableId)' type='application/json'>{
856 @ "iTableId": %d(iTableId),
857 @ "circleNodes": %d(circleNodes),
858 @ "showArrowheads": %d(showArrowheads),
859 @ "iRailPitch": %d(iRailPitch),
@@ -859,10 +865,11 @@
865 @ "scrollToSelect": %d(scrollToSelect),
866 @ "nrail": %d(pGraph->mxRail+1),
867 @ "baseUrl": "%R",
868 @ "dwellTimeout": %d(dwellTimeout),
869 @ "closeTimeout": %d(closeTimeout),
870 @ "digitHuman": %d(nDigitHuman),
871 @ "bottomRowId": "btm-%d(iTableId)",
872 if( pGraph->nRow==0 ){
873 @ "rowinfo": null
874 }else{
875 @ "rowinfo": [
876

Keyboard Shortcuts

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