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

[PATCH QGit 3/4] Avoid submenus with merely 1 entry

From
Markus Heidelberg <markus.heidelberg@web.de>
Date
Jun 6, 2009, 11:57 UTC
Message-ID
<1244289471-698-4-git-send-email-markus.heidelberg@web.de>

Display the branch/tag in the main context menu in these cases, where only the last branch/tag would go into a submenu.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 src/mainimpl.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mainimpl.cpp b/src/mainimpl.cpp
index 24b4ef1..38bbfbe 100644
--- a/src/mainimpl.cpp
+++ b/src/mainimpl.cpp
@@ -1197,7 +1197,8 @@ void MainImpl::doContexPopup(SCRef sha) {
 			contextMenu.addSeparator();
 
 		FOREACH_SL (it, bn) {
-			if (cntMenuEntries(contextMenu) < MAX_MENU_ENTRIES)
+			if (cntMenuEntries(contextMenu) < MAX_MENU_ENTRIES
+					|| (*it == bn.last() && contextSubMenu.isEmpty() && tn.empty()))
 				act = contextMenu.addAction(*it);
 			else
 				act = contextSubMenu.addAction(*it);
@@ -1211,7 +1212,8 @@ void MainImpl::doContexPopup(SCRef sha) {
 				contextMenu.addSeparator();
 
 		FOREACH_SL (it, tn) {
-			if (cntMenuEntries(contextMenu) < MAX_MENU_ENTRIES)
+			if (cntMenuEntries(contextMenu) < MAX_MENU_ENTRIES
+					|| (*it == tn.last() && contextSubMenu.isEmpty()))
 				act = contextMenu.addAction(*it);
 			else
 				act = contextSubMenu.addAction(*it);
-- 
1.6.3.2.213.g30b07
Message 1 of 1 in “Avoid submenus with merely 1 entry”
  1. 3/4 Avoid submenus with merely 1 entryMarkus Heidelberg, Jun 6, 2009

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.