threads / bug / 31699

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

Subject: [BUG] gitk: clicking on a connecting line produces can't read "cflist_top"

## tl;dr

5 messages between Oct 1, 2012 and Oct 21, 2012.

replies: 4people: 3as markdown or json

Johannes Sixt· Oct 1, 2012, 08:40 UTC · lore
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
Stefan Haller· Oct 4, 2012, 20:50 UTC · re: Johannes Sixt · lore

Re: [BUG] gitk: clicking on a connecting line produces can't read "cflist_top"

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

Stefan Haller· Oct 4, 2012, 20:50 UTC · re: Stefan Haller · lore

[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").

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
---
 gitk | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/gitk b/gitk
index 379582a..8935284 100755
--- a/gitk
+++ b/gitk
@@ -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
-- 
1.8.0.rc0.36.gef0f079
Stefan Haller· Oct 4, 2012, 20:50 UTC · re: Stefan Haller · lore

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

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.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
---
 gitk | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/gitk b/gitk
index 8935284..0ee5585 100755
--- a/gitk
+++ b/gitk
@@ -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}
-- 
1.8.0.rc0.36.gef0f079
Paul Mackerras· Oct 21, 2012, 22:25 UTC · re: Stefan Haller · lore

Re: [BUG] gitk: clicking on a connecting line produces can't read "cflist_top"

On Thu, Oct 04, 2012 at 10:50:15PM +0200, Stefan Haller wrote:
Show 8 quoted lines
> 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.

← back to recent threads