git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: Do not select file list entries during diff loading

From
Peter Oberndorfer <kumbayo84@arcor.de>
Date
Oct 26, 2012, 22:03 UTC
Message-ID
<508B08CB.5060702@arcor.de>
In-Reply-To
<1348078647-22516-1-git-send-email-stefan@haller-berlin.de>

Scrolling notification works by callingscrolltext{} with with 2 values between 0 and 1 for the beginning and the end of the view relative to the total length. When a long diff with several files is loaded, the diff view length is updated several times and causes executions of scrolltext{} even when the current view never changed.

Every time scrolltext{} is executed, a entry in the file list is selected and scrolled to.

This makes it impossible for a user to scroll the file list while a long diff is still loading.

Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
---
Hi,

i used v3 of the Synchronize patch (+ the 2 fixes on top) for some time now on mingw, but i found a slight problem for my usage.

While the diff is loaded, the file list on the right side always scrolls up. When a single revision touches hundreds of files [1] the loading takes quite long. During the diff loading i want to scroll down in the file list to the relevant file i am interested in. But the file list jumps up all the time.

Please review/test the patch carefully before applying, since i do not often work with tcl/tk :-) (Or suggest better ways to solve this problem)

Greetings Peter

[1] I imported history of a historic project. Each release is represented by a single commit. Thus one commit contains a lot of files/big amount of changes. But most times i am interested in only a single file in the middle of the file list.

 gitk-git/gitk | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index b294c9e..621db87 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -8004,7 +8004,7 @@ proc nextfile {} {

 proc clear_ctext {{first 1.0}} {
     global ctext smarktop smarkbot
-    global ctext_file_names ctext_file_lines
+    global ctext_file_names ctext_file_lines ctext_last_scroll_pos
     global pendinglinks

     set l [lindex [split $first .] 0]
@@ -8020,6 +8020,7 @@ proc clear_ctext {{first 1.0}} {
     }
     set ctext_file_names {}
     set ctext_file_lines {}
+    set ctext_last_scroll_pos -1
 }

 proc settabs {{firstab {}}} {
@@ -8162,21 +8163,24 @@ proc
suppress_highlighting_file_for_current_scrollpos {} {
 }

 proc scrolltext {f0 f1} {
-    global searchstring cmitmode ctext
+    global searchstring cmitmode ctext ctext_last_scroll_pos
     global suppress_highlighting_file_for_this_scrollpos

+    .bleft.bottom.sb set $f0 $f1
+    if {$searchstring ne {}} {
+	searchmarkvisible 0
+    }
+
     set topidx [$ctext index @0,0]
+    if {$topidx eq $ctext_last_scroll_pos} return
+    set ctext_last_scroll_pos $topidx
+
     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}
-
-    .bleft.bottom.sb set $f0 $f1
-    if {$searchstring ne {}} {
-	searchmarkvisible 0
-    }
 }

 proc setcoords {} {
@@ -11643,6 +11647,7 @@ set autoselect 1
 set autosellen 40
 set perfile_attrs 0
 set want_ttk 1
+set ctext_last_scroll_pos -1

 if {[tk windowingsystem] eq "aqua"} {
     set extdifftool "opendiff"
-- 
1.8.0.rc2.251.g3315d86
Previous: Stefan HallerNext: Stefan Haller
Message 9 of 10 in “gitk: Synchronize highlighting in file view when scrolling diff”
  1. gitk: Synchronize highlighting in file view when scrolling diffStefan Haller, Sep 18, 2012
  2. Peter OberndorferSep 18, 2012
  3. gitk: Synchronize highlighting in file view when scrolling diffStefan Haller, Sep 19, 2012
  4. Paul MackerrasSep 18, 2012
  5. Marc BranchaudSep 19, 2012
  6. gitk: Synchronize highlighting in file view when scrolling diffStefan Haller, Sep 19, 2012
  7. Paul MackerrasSep 23, 2012
  8. Stefan HallerSep 24, 2012
  9. gitk: Do not select file list entries during diff loadingPeter Oberndorfer, Oct 26, 2012
  10. Stefan HallerOct 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.