From 7e0af8e116a919e299e8175a3c24e0a4c868aedd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi
Date: Fri, 28 Apr 2023 10:35:44 +0300
Subject: [PATCH 1/1] Open new tabs to the right of the current tab; closing
steps leftward
IssueID #594
res/about/version.gmi | 1 +
src/app.c | 9 +++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/res/about/version.gmi b/res/about/version.gmi
index 32585880..8f07b9e8 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -8,6 +8,7 @@
+* Improved opening and closing of tabs. New tabs now open to the right of the current tab.
diff --git a/src/app.c b/src/app.c
index 590913cf..5abfdb4e 100644
--- a/src/app.c
+++ b/src/app.c
@@ -2940,6 +2940,7 @@ iDocumentWidget *document_Command(const char *cmd) {
iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, iBool switchToNew) {
iWidget *tabs = findWidget_Root("doctabs");
setFlags_Widget(tabs, hidden_WidgetFlag, iFalse);
iWidget *newTabButton = findChild_Widget(tabs, "newtab");
removeChild_Widget(newTabButton->parent, newTabButton);
@@ -2952,6 +2953,8 @@ iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, iBool switchToNe
}
appendTabPage_Widget(tabs, as_Widget(doc), "", 0, 0);
iRelease(doc); /* now owned by the tabs */
addTabCloseButton_Widget(tabs, as_Widget(doc), "tabs.close");
addChild_Widget(findChild_Widget(tabs, "tabs.buttons"), iClob(newTabButton));
showOrHideNewTabButton_Root(tabs->root);
@@ -4312,9 +4315,6 @@ iBool handleCommand_App(const char *cmd) {
cancelAllRequests_DocumentWidget(closed);
destroy_Widget(as_Widget(closed)); /* released later */
}
if (index == tabCount_Widget(tabs)) {
index--;
}
if (tabCount_Widget(tabs) == 0) {
iAssert(isSplit);
postCommand_App("ui.split arg:0");
@@ -4322,7 +4322,8 @@ iBool handleCommand_App(const char *cmd) {
else {
arrange_Widget(tabs);
if (wasCurrent) {
postCommandf_App("tabs.switch page:%p", tabPage_Widget(tabs, index));
postCommandf_App("tabs.switch page:%p",
tabPage_Widget(tabs, index > 0 ? index - 1 : 0));
}
}
}
--
2.25.1
text/plain
This content has been proxied by September (ba2dc).