Lagrange [release]

"New Tab" should append tabs to the right edge of tab bar

=> 0de81a7ae363e467cda383869c38b0251cf29c55

diff --git a/res/about/version.gmi b/res/about/version.gmi
index f56e8d23..55469551 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -6,6 +6,9 @@
 ```
 # Release notes
 
+## 1.16.5
+* "New Tab" (Ctrl+T/⌘T) and the tab bar [+] button append the tab to the right edge. Previously it was inserted next to the active tab.
+
 ## 1.16.4
 * Context/button menus use a popup window if they would otherwise have to scroll (e.g., "Dark theme:" in Preferences and "Folder:" in the bookmark editor).
 * Improved tab closing order: close all sibling tabs opened from an origin tab before switching back to the origin tab.
diff --git a/src/app.c b/src/app.c
index 0f8ba208..366037dd 100644
--- a/src/app.c
+++ b/src/app.c
@@ -2961,7 +2961,6 @@ iDocumentWidget *document_Command(const char *cmd) {
 
 iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, int newTabFlags) {
     iWidget *tabs = findWidget_Root("doctabs");
-    size_t currentTabIndex = tabPageIndex_Widget(tabs, document_App());
     setFlags_Widget(tabs, hidden_WidgetFlag, iFalse);
     iWidget *newTabButton = findChild_Widget(tabs, "newtab");
     removeChild_Widget(newTabButton->parent, newTabButton);
@@ -2974,15 +2973,16 @@ iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, int newTabFlags)
     }
     appendTabPage_Widget(tabs, as_Widget(doc), "", 0, 0);
     iRelease(doc); /* now owned by the tabs */
-    /* Find and move to the insertion point. */ {
+    /* Find and move to the insertion point. */
+    if (~newTabFlags & append_NewTabFlag) {
         const size_t insertAt = tabPageIndex_Widget(
             tabs, findChild_Widget(tabs, cstr_String(&get_Root()->tabInsertId)));
         if (insertAt != iInvalidPos) {
             moveTabPage_Widget(tabs, tabCount_Widget(tabs) - 1, insertAt + 1);
         }
-        /* The next tab comes here. */
-        set_String(&as_Widget(doc)->root->tabInsertId, id_Widget(as_Widget(doc)));
     }
+    /* The next tab comes here. */
+    set_String(&as_Widget(doc)->root->tabInsertId, id_Widget(as_Widget(doc)));
     addTabCloseButton_Widget(tabs, as_Widget(doc), "tabs.close");
     addChild_Widget(findChild_Widget(tabs, "tabs.buttons"), iClob(newTabButton));
     showOrHideNewTabButton_Root(tabs->root);
@@ -4302,8 +4302,10 @@ iBool handleCommand_App(const char *cmd) {
             }
             return iTrue;
         }
+        const iBool isAppend    = argLabel_Command(cmd, "append") != 0;
         const iBool isDuplicate = argLabel_Command(cmd, "duplicate") != 0;
-        newTab_App(isDuplicate ? document_App() : NULL, switchTo_NewTabFlag);
+        newTab_App(isDuplicate ? document_App() : NULL,
+                   switchTo_NewTabFlag | (isAppend ? append_NewTabFlag : 0));
         if (!isDuplicate) {
             postCommandf_App("navigate.home focus:%d", deviceType_App() == desktop_AppDeviceType);
         }
diff --git a/src/app.h b/src/app.h
index 47be3f19..5a533ff1 100644
--- a/src/app.h
+++ b/src/app.h
@@ -79,6 +79,7 @@ enum iUserEventCode {
 
 enum iNewTabFlag {
     switchTo_NewTabFlag = iBit(1),
+    append_NewTabFlag   = iBit(2),
 };
 
 const iString *execPath_App     (void);
diff --git a/src/macos.m b/src/macos.m
index 91e2d50c..fb8acf5a 100644
--- a/src/macos.m
+++ b/src/macos.m
@@ -419,7 +419,7 @@ static void appearanceChanged_MacOS_(NSString *name) {
         return [[CommandButton alloc] initWithIdentifier:identifier
                                                    image:[NSImage imageNamed:NSImageNameTouchBarAddTemplate]
                                                   widget:nil
-                                                 command:@"tabs.new"];
+                                                 command:@"tabs.new append:1"];
     }
     return nil;
 }
diff --git a/src/ui/keys.c b/src/ui/keys.c
index 3bfa9302..4913f582 100644
--- a/src/ui/keys.c
+++ b/src/ui/keys.c
@@ -226,7 +226,7 @@ static const struct { int id; iMenuItem bind; int flags; } defaultBindings_[] =
 #if !defined (iPlatformApple) /* Ctrl-Cmd-F on macOS */
     { 73, { "${keys.fullscreen}",           SDLK_F11, 0,                    "window.fullscreen"                 }, 0 },
 #endif
-    { 76, { "${keys.tab.new}",              newTab_KeyShortcut,             "tabs.new"                          }, 0 },
+    { 76, { "${keys.tab.new}",              newTab_KeyShortcut,             "tabs.new append:1"                 }, 0 },
     { 77, { "${keys.tab.close}",            closeTab_KeyShortcut,           "tabs.close"                        }, 0 },
     { 78, { "${keys.tab.close.other}",      SDLK_w, KMOD_SECONDARY,         "tabs.close toleft:1 toright:1"     }, 0 },
     { 79, { "${LC:menu.reopentab}",         SDLK_t, KMOD_SECONDARY,         "tabs.new reopen:1"                 }, 0 },        
diff --git a/src/ui/mobile.c b/src/ui/mobile.c
index 404c39a1..419298a5 100644
--- a/src/ui/mobile.c
+++ b/src/ui/mobile.c
@@ -43,7 +43,7 @@ const iToolbarActionSpec toolbarActions_Mobile[max_ToolbarAction] = {
     { home_Icon, "${menu.home}", "navigate.home" },
     { upArrow_Icon, "${menu.parent}", "navigate.parent" },
     { reload_Icon, "${menu.reload}", "navigate.reload" },
-    { add_Icon, "${menu.newtab}", "tabs.new" },
+    { add_Icon, "${menu.newtab}", "tabs.new append:1" },
     { close_Icon, "${menu.closetab}", "tabs.close" },
     { bookmark_Icon, "${menu.page.bookmark}", "bookmark.add" },
     { globe_Icon, "${menu.page.translate}", "document.translate" },
diff --git a/src/ui/root.c b/src/ui/root.c
index ac708342..bc7cf4b4 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -55,7 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
 
 static const iMenuItem desktopNavMenuItems_[] = {
     { openWindow_Icon " ${menu.newwindow}", SDLK_n, KMOD_PRIMARY, "window.new" },
-    { add_Icon " ${menu.newtab}", SDLK_t, KMOD_PRIMARY, "tabs.new" },
+    { add_Icon " ${menu.newtab}", SDLK_t, KMOD_PRIMARY, "tabs.new append:1" },
     { close_Icon " ${menu.closetab}", SDLK_w, KMOD_PRIMARY, "tabs.close" },
     { "${menu.openlocation}", SDLK_l, KMOD_PRIMARY, "navigate.focus" },
     { "---" },
@@ -85,7 +85,7 @@ static const iMenuItem desktopNavMenuItems_[] = {
 };
 
 static const iMenuItem tabletNavMenuItems_[] = {
-    { add_Icon " ${menu.newtab}", SDLK_t, KMOD_PRIMARY, "tabs.new" },
+    { add_Icon " ${menu.newtab}", SDLK_t, KMOD_PRIMARY, "tabs.new append:1" },
     { folder_Icon " ${menu.openfile}", SDLK_o, KMOD_PRIMARY, "file.open" },
     { "---" },
     { close_Icon " ${menu.closetab}", 'w', KMOD_PRIMARY, "tabs.close" },
@@ -102,7 +102,7 @@ static const iMenuItem tabletNavMenuItems_[] = {
 };
 
 static const iMenuItem phoneNavMenuItems_[] = {
-    { add_Icon " ${menu.newtab}", SDLK_t, KMOD_PRIMARY, "tabs.new" },
+    { add_Icon " ${menu.newtab}", SDLK_t, KMOD_PRIMARY, "tabs.new append:1" },
     { folder_Icon " ${menu.openfile}", SDLK_o, KMOD_PRIMARY, "file.open" },
     { "---" },
     { close_Icon " ${menu.closetab}", 'w', KMOD_PRIMARY, "tabs.close" },
@@ -1792,7 +1792,8 @@ void createUserInterface_Root(iRoot *d) {
             setBackgroundColor_Widget(buttons, uiBackground_ColorId);
         }
         setId_Widget(
-            addChildFlags_Widget(buttons, iClob(newIcon_LabelWidget(add_Icon, 0, 0, "tabs.new")),
+            addChildFlags_Widget(buttons,
+                                 iClob(newIcon_LabelWidget(add_Icon, 0, 0, "tabs.new append:1")),
                                  moveToParentRightEdge_WidgetFlag | collapse_WidgetFlag),
             "newtab");
     }
diff --git a/src/ui/window.c b/src/ui/window.c
index 94df1c7a..8c2a36ac 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -73,7 +73,7 @@ iDefineTypeConstructionArgs(MainWindow, (iRect rect), rect)
 
 static const iMenuItem fileMenuItems_[] = {
     { "${menu.newwindow}", SDLK_n, KMOD_PRIMARY, "window.new" },
-    { "${menu.newtab}", SDLK_t, KMOD_PRIMARY, "tabs.new" },
+    { "${menu.newtab}", SDLK_t, KMOD_PRIMARY, "tabs.new append:1" },
     { "${menu.openlocation}", SDLK_l, KMOD_PRIMARY, "navigate.focus" },
     { "${menu.reopentab}", SDLK_t, KMOD_SECONDARY, "tabs.new reopen:1" },
     { "---" },
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/release/cdiff/0de81a7ae363e467cda383869c38b0251cf29c55
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
72.782041 milliseconds
Gemini-to-HTML Time
0.520536 milliseconds

This content has been proxied by September (ba2dc).