Repository navigation
Commit dd858b5
Document why
The focus-restore is best-effort: `workbench.action.terminal.clear` always
focuses the terminal, and VS Code's stable API exposes no way to learn what
was focused before the clear (`TerminalState` has no focus flag, and
`activeTextEditor` does not go `undefined` when the terminal is focused). So
we can't perfectly return focus to wherever it was.
Spell out the resulting caveat in a comment: running `Clear-Host` directly in
the console while `focusConsoleOnExecute` is `false` will also move focus to
the editor. That edge case is consistent with the user's stated preference to
keep focus in the editor, and fixing it properly isn't possible without a
focus-state signal the API doesn't provide.
Drafted by Copilot (Claude Opus 4.8).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>clearTerminal can't restore prior focus1 parent ce7f498 commit dd858b5
1 file changed
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
342 | | - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
343 | 348 | | |
344 | 349 | | |
345 | 350 | | |
| |||
0 commit comments