From 9bfa128658767ea26b392c072d5c4e717fe53832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Thu, 4 Jun 2026 16:42:10 -0300 Subject: [PATCH] Use the new tab position setting for *all* new tabs (SpartanJ/ecode#904). --- bin/assets/plugins/aiassistant.json | 4 +++ src/tools/ecode/ecode.cpp | 27 +++++++++++++++++++ src/tools/ecode/ecode.hpp | 41 +++-------------------------- 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/bin/assets/plugins/aiassistant.json b/bin/assets/plugins/aiassistant.json index 00945f63c..be62ca109 100644 --- a/bin/assets/plugins/aiassistant.json +++ b/bin/assets/plugins/aiassistant.json @@ -447,6 +447,10 @@ { "name": "minimax/minimax-m2.5:free", "display_name": "MiniMax: MiniMax M2.5 (free)" + }, + { + "name": "NVIDIA: Nemotron 3 Ultra (free)", + "display_name": "nvidia/nemotron-3-ultra-550b-a55b:free" } ] }, diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index d3b490245..419d6cea8 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -1818,6 +1818,33 @@ void App::onTabCreated( UITab* tab, UIWidget* ) { } } ); } ); + + applyNewTabPosition( tab ); +} + +void App::applyNewTabPosition( UITab* tab ) { + UITabWidget* tabWidget = tab->getTabWidget(); + if ( !tabWidget ) + return; + switch ( mConfig.editor.newTabPosition ) { + case NewTabPosition::AfterActive: { + Uint32 selectedIdx = tabWidget->getTabSelectedIndex(); + Uint32 newIdx = eemin( selectedIdx + 1, tabWidget->getTabCount() - 1 ); + tabWidget->moveTab( tab, newIdx ); + break; + } + case NewTabPosition::First: + tabWidget->moveTab( tab, 0 ); + break; + case NewTabPosition::LeftOfActive: { + Uint32 selectedIdx = tabWidget->getTabSelectedIndex(); + tabWidget->moveTab( tab, eemin( selectedIdx, tabWidget->getTabCount() - 1 ) ); + break; + } + case NewTabPosition::Last: + default: + break; + } } void App::onColorSchemeChanged( const std::string& ) { diff --git a/src/tools/ecode/ecode.hpp b/src/tools/ecode/ecode.hpp index aaad561f1..36bdf514e 100644 --- a/src/tools/ecode/ecode.hpp +++ b/src/tools/ecode/ecode.hpp @@ -384,44 +384,7 @@ class App : public UICodeEditorSplitter::Client, public PluginContextProvider { mSplitter->registerSplitterCommands( t ); // Overwrite it - t.setCommand( "create-new", [this] { - UITabWidget* tabWidget = getSplitter()->getPreferredTabWidget(); - Uint32 selectedIdx = - tabWidget && tabWidget->getTabCount() > 0 ? tabWidget->getTabSelectedIndex() : 0; - auto d = getSplitter()->createCodeEditorInTabWidget( tabWidget ); - if ( d.first == nullptr || d.second == nullptr ) { - if ( !getSplitter()->getTabWidgets().empty() ) { - tabWidget = getSplitter()->getTabWidgets()[0]; - selectedIdx = tabWidget && tabWidget->getTabCount() > 0 - ? tabWidget->getTabSelectedIndex() - : 0; - d = getSplitter()->createCodeEditorInTabWidget( tabWidget ); - } - } - if ( d.first == nullptr || d.second == nullptr ) { - Log::error( "Couldn't createCodeEditorInTabWidget in create-new command" ); - return; - } - tabWidget = d.first->getTabWidget(); - switch ( mConfig.editor.newTabPosition ) { - case NewTabPosition::AfterActive: { - Uint32 newIdx = eemin( selectedIdx + 1, tabWidget->getTabCount() - 1 ); - tabWidget->moveTab( d.first, newIdx ); - break; - } - case NewTabPosition::First: - tabWidget->moveTab( d.first, 0 ); - break; - case NewTabPosition::LeftOfActive: - tabWidget->moveTab( - d.first, eemin( selectedIdx, tabWidget->getTabCount() - 1 ) ); - break; - case NewTabPosition::Last: - default: - break; - } - tabWidget->setTabSelected( d.first ); - } ); + t.setCommand( "create-new", [this] { getSplitter()->createEditorInNewTab(); } ); t.setCommand( "next-tab", [this] { UITabWidget* tabWidget = @@ -871,6 +834,8 @@ class App : public UICodeEditorSplitter::Client, public PluginContextProvider { void onTabCreated( UITab* tab, UIWidget* widget ); + void applyNewTabPosition( UITab* tab ); + bool trySendUnlockedCmd( const KeyEvent& keyEvent ); FontTrueType* loadFont( const std::string& name, std::string fontPath,