Fix a focusing issue when moving a terminal to the status bar terminal, hiding the terminal would not focus any editor.

This commit is contained in:
Martín Lucas Golini
2026-02-17 21:46:10 -03:00
parent a9901ef23b
commit 19230cc2fb
2 changed files with 18 additions and 0 deletions

View File

@@ -517,6 +517,19 @@ void UICodeEditorSplitter::setCurrentEditor( UICodeEditor* editor ) {
}
void UICodeEditorSplitter::setCurrentWidget( UIWidget* curWidget ) {
if ( curWidget == nullptr ) {
if ( mCurEditor ) {
mCurWidget = mCurEditor;
mClient->onWidgetFocusChange( curWidget );
} else {
// Should never happen: curWidget == nullptr is passed when a terminal is moved outside
// the splitter
auto editor = getSomeEditor();
if ( editor )
setCurrentWidget( editor );
}
return;
}
if ( curWidget->isType( UI_TYPE_CODEEDITOR ) ) {
setCurrentEditor( curWidget->asType<UICodeEditor>() );
return;

View File

@@ -555,6 +555,11 @@ UITerminal* TerminalManager::createNewTerminal(
ret.first->setIcon( mApp->findIcon( "filetype-bash" ) );
mApp->getSplitter()->removeUnusedTab( tabWidget, true, false );
term->removeEventsOfType( Event::OnFocus );
term->on( Event::OnFocus, [this, term]( const Event* ) {
mApp->getSplitter()->setCurrentWidget(
mApp->getSplitter()->getBaseLayout()->inParentTreeOf( term ) ? term : nullptr );
} );
term->setTitle( title );
auto csIt = mTerminalColorSchemes.find( mTerminalCurrentColorScheme );
term->getTerm()->getTerminal()->setAllowMemoryTrimnming( true );