Skip to contentSkip to conversation

gitk: clicking on a connecting line produces can't read "cflist_top"

BUG New Johannes Sixt 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Clicking on a line that connects commit nodes produces this error:

can't read "cflist_top": no such variable
can't read "cflist_top": no such variable
while executing
"$cflist tag remove highlight $cflist_top.0 "$cflist_top.0 lineend""
(procedure "highlightfile" line 4)
invoked from within
"highlightfile 0"
(procedure "highlightfile_for_scrollpos" line 8) invoked from within
"highlightfile_for_scrollpos $topidx"
(procedure "scrolltext" line 9)
invoked from within
"scrolltext 0.0 1.0"
(vertical scrolling command executed by text)

Bisection points to b967135d (Synchronize highlighting in file view when scrolling diff).

gitk remains responsive after the error window is closed, so it is not urgent. A fix would be appreciated nevertheless.

-- Hannes

#1 lore raw

Sorry, I didn't realize that there is a display mode where the list of files is empty, not even showing a "Comments" entry.

Here's a patch that fixes it, plus another patch that is only related in so far as the bug that it fixes was introduced by the same commit.

[PATCH 1/2] gitk: Fix error message when clicking on a connecting line [PATCH 2/2] gitk: When searching, only highlight files when in Patch mode

#2 lore raw

PATCH 1/2 gitk: Fix error message when clicking on a connecting line

When clicking on the line that connects two commit nodes, gitk would bring up an error dialog saying "can't read "cflist_top":
no such variable".

This fixes a regression that was introduced with b967135 ("gitk:
Synchronize highlighting in file view when scrolling diff").

---
 gitk | 2 ++
 1 file changed, 2 insertions(+)
gitk +2 -0
index 379582a..8935284 100755
@@ -7958,6 +7958,8 @@ proc changediffdisp {} {
 proc highlightfile {cline} {
     global cflist cflist_top
 
+    if {![info exists cflist_top]} return
+
     $cflist tag remove highlight $cflist_top.0 "$cflist_top.0 lineend"
     $cflist tag add highlight $cline.0 "$cline.0 lineend"
     $cflist see $cline.0
Signature · 1 line
1.8.0.rc0.36.gef0f079
#3 lore raw

PATCH 2/2 gitk: When searching, only highlight files when in Patch mode

In reply to Stefan Haller

This fixes another regression that was introduced in b967135 ("gitk:
Synchronize highlighting in file view when scrolling diff"): when searching for a string in tree mode, jumping to the next search hit would highlight the "Comments" entry in the file list.

---
 gitk | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
gitk +6 -7
index 8935284..0ee5585 100755
@@ -7967,8 +7967,9 @@ proc highlightfile {cline} {
 }
 
 proc highlightfile_for_scrollpos {topidx} {
-    global difffilestart
+    global cmitmode difffilestart
 
+    if {$cmitmode eq "tree"} return
     if {![info exists difffilestart]} return
 
     set top [lindex [split $topidx .] 0]
@@ -8192,12 +8193,10 @@ proc scrolltext {f0 f1} {
     global searchstring cmitmode ctext
     global suppress_highlighting_file_for_this_scrollpos
 
-    if {$cmitmode ne "tree"} {
-	set topidx [$ctext index @0,0]
-	if {![info exists suppress_highlighting_file_for_this_scrollpos]
-	    || $topidx ne $suppress_highlighting_file_for_this_scrollpos} {
-	    highlightfile_for_scrollpos $topidx
-	}
+    set topidx [$ctext index @0,0]
+    if {![info exists suppress_highlighting_file_for_this_scrollpos]
+	|| $topidx ne $suppress_highlighting_file_for_this_scrollpos} {
+	highlightfile_for_scrollpos $topidx
     }
 
     catch {unset suppress_highlighting_file_for_this_scrollpos}
Signature · 1 line
1.8.0.rc0.36.gef0f079
#4 lore raw
In reply to Stefan Haller
Quoted 8 lines · Stefan Haller

Sorry, I didn't realize that there is a display mode where the list of files is empty, not even showing a "Comments" entry.

Here's a patch that fixes it, plus another patch that is only related in so far as the bug that it fixes was introduced by the same commit.

[PATCH 1/2] gitk: Fix error message when clicking on a connecting line [PATCH 2/2] gitk: When searching, only highlight files when in Patch mode

Thanks, applied both.

Paul.