diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index a3c17f6b2..4106cf2d5 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -2181,6 +2181,7 @@ std::map App::getMigrateKeybindings() { std::vector App::getUnlockedCommands() { return { "create-new", "create-new-terminal", + "create-new-welcome-tab", "fullscreen-toggle", "open-file", "open-folder", @@ -2331,11 +2332,15 @@ void App::closeFolder() { if ( mUniversalLocator ) mUniversalLocator->updateFilesTable(); if ( getConfig().ui.welcomeScreen ) { - UIWelcomeScreen::createWelcomeScreen( this ); + createWelcomeTab(); mStatusBar->setVisible( false ); } } +void App::createWelcomeTab() { + UIWelcomeScreen::createWelcomeScreen( this ); +} + void App::createDocDirtyAlert( UICodeEditor* editor, bool showEnableAutoReload ) { UILinearLayout* docAlert = editor->findByClass( "doc_alert" ); @@ -3332,7 +3337,7 @@ void App::initProjectTreeView( std::string path, bool openClean ) { updateOpenRecentFolderBtn(); if ( getConfig().ui.welcomeScreen ) { - UIWelcomeScreen::createWelcomeScreen( this ); + createWelcomeTab(); mStatusBar->setVisible( false ); } } @@ -3700,7 +3705,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe } ); #endif - Log::info( "Window creation took: %.2f ms", globalClock.getElapsedTime().asMilliseconds() ); + Log::info( "Window creation took: %s", globalClock.getElapsedTime().toString() ); mWindow->setFrameRateLimit( mConfig.context.FrameRateLimit ); diff --git a/src/tools/ecode/ecode.hpp b/src/tools/ecode/ecode.hpp index 1285c339e..b4f589722 100644 --- a/src/tools/ecode/ecode.hpp +++ b/src/tools/ecode/ecode.hpp @@ -320,6 +320,7 @@ class App : public UICodeEditorSplitter::Client { Sys::execute( cmd ); } } ); + t.setCommand( "create-new-welcome-tab", [this] { createWelcomeTab(); } ); mSplitter->registerSplitterCommands( t ); } @@ -662,6 +663,8 @@ class App : public UICodeEditorSplitter::Client { void insertRecentFile( const std::string& path ); void insertRecentFileAndUpdateUI( const std::string& path ); + + void createWelcomeTab(); }; } // namespace ecode diff --git a/src/tools/ecode/universallocator.cpp b/src/tools/ecode/universallocator.cpp index e173d43e1..8a21c02bc 100644 --- a/src/tools/ecode/universallocator.cpp +++ b/src/tools/ecode/universallocator.cpp @@ -130,11 +130,10 @@ UniversalLocator::UniversalLocator( UICodeEditorSplitter* editorSplitter, UIScen if ( idx.isValid() ) { String cmd = modelEvent->getModel()->data( idx, ModelRole::Display ).toString(); mApp->runCommand( cmd ); - if ( !mSplitter->getCurWidget()->isType( UI_TYPE_TERMINAL ) ) { - if ( mSplitter->curEditorIsNotNull() && - mSplitter->getCurEditor()->getDocument().hasCommand( cmd ) ) - mSplitter->getCurEditor()->setFocus(); - } + if ( mSplitter->getCurWidget()->isType( UI_TYPE_CODEEDITOR ) && + mSplitter->curEditorIsNotNull() && + mSplitter->getCurEditor()->getDocument().hasCommand( cmd ) ) + mSplitter->getCurEditor()->setFocus(); if ( cmd != "open-locatebar" && cmd != "open-workspace-symbol-search" && cmd != "open-document-symbol-search" && cmd != "go-to-line" && cmd != "show-open-documents" ) {