Skip to content

Commit

Permalink
Also fix focus when toggling panel
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- committed Apr 25, 2024
1 parent ea77fb5 commit c323865
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,13 @@ export class PositronConsoleViewPane extends ViewPane implements IReactComponent
// Trigger event that eventually causes console input widgets (main
// input, readline input, or restart buttons) to focus. Must be after
// the super call.
this.positronConsoleService.activePositronConsoleInstance?.focusInput();
//
// We do this at the next tick because in some cases `focus()` is called
// when the viewpane is not visible yet (don't trust `this.isBodyVisible()`).
// In this case the `focus()` call fails (don't trust `this.onFocus()`).
// This happens for instance with `workbench.action.togglePanel` or
// `workbench.action.toggleSecondarySideBar`.
setTimeout(() => this.positronConsoleService.activePositronConsoleInstance?.focusInput());
}

/**
Expand Down

0 comments on commit c323865

Please sign in to comment.