Skip to contentSkip to conversation

Avoid submenus with merely 1 entry

PATCH In review Markus Heidelberg 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 Avoid submenus with merely 1 entry

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

---
 src/mainimpl.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
src/mainimpl.cpp +4 -2
index 24b4ef1..38bbfbe 100644
@@ -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);
Signature · 1 line
1.6.3.2.213.g30b07