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

[PATCH v3 4/4] git gui: allow for a long recentrepo list

From
Philip Oakley <philipoakley@iee.org>
Date
Jan 22, 2017, 19:53 UTC
Message-ID
<20170122195301.1784-5-philipoakley@iee.org>
In-Reply-To
<20170122195301.1784-1-philipoakley@iee.org>

The gui.recentrepo list may be longer than the maxrecent setting. Allow extra space to show any extra entries.

In an ideal world, the git gui would limit the number of entries to the maxrecent setting, however the recentrepo config list may have been extended outwith the gui, or the maxrecent setting changed to a reduced value. Further, when testing the gui's recentrepo logic it is useful to show these extra, but valid, entries.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---
 lib/choose_repository.tcl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index f39636f..80f5a59 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -142,6 +142,10 @@ constructor pick {} {
 				-label [mc "Recent Repositories"]
 		}
 
+	if {[set lenrecent [llength $sorted_recent]] < $maxrecent} {
+		set lenrecent $maxrecent
+	}
+
 		${NS}::label $w_body.space
 		${NS}::label $w_body.recentlabel \
 			-anchor w \
@@ -153,7 +157,7 @@ constructor pick {} {
 			-background [get_bg_color $w_body.recentlabel] \
 			-wrap none \
 			-width 50 \
-			-height $maxrecent
+			-height $lenrecent
 		$w_recentlist tag conf link \
 			-foreground blue \
 			-underline 1
-- 
2.9.0.windows.1.323.g0305acf
Previous: Philip OakleyNext: Philip Oakley
Message 5 of 6 in “git gui: allow for a long recentrepo list”
  1. 0/4 git gui: allow for a long recentrepo listPhilip Oakley, Jan 22, 2017
  2. 2/4 git gui: cope with duplicates in _get_recentrepoPhilip Oakley, Jan 22, 2017
  3. 3/4 git gui: de-dup selected repo from recentrepo historyPhilip Oakley, Jan 22, 2017
  4. 1/4 git-gui: remove duplicate entries from .gitconfig's gui.recentrepoPhilip Oakley, Jan 22, 2017
  5. 4/4 git gui: allow for a long recentrepo listPhilip Oakley, Jan 22, 2017
  6. Philip OakleyFeb 11, 2017

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.