terminal: Respect RevealStrategy::NoFocus and Never focus settings#45180
Merged
Veykril merged 1 commit intozed-industries:mainfrom Dec 18, 2025
Merged
Conversation
The focus logic in add_terminal_task() and add_terminal_shell() was checking if the pane already had focus, which caused terminals to steal focus even when RevealStrategy::NoFocus or Never was specified. This contradicts the documented behavior: - NoFocus: "don't focus it" - Never: "Do not alter focus" The fix changes the focus calculation from: `pane.has_focus(window, cx) || matches!(reveal_strategy, RevealStrategy::Always)` to: `matches!(reveal_strategy, RevealStrategy::Always)` This ensures focus is only given when explicitly requested via Always strategy. Fixes zed-industries#45179
|
We require contributors to sign our Contributor License Agreement, and we don't have @rabsef-bicrym on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
Contributor
Author
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
3 tasks
rtfeldman
pushed a commit
that referenced
this pull request
Jan 5, 2026
…45180) Closes #45179 ## Summary Fixes the focus behavior when creating terminals with `RevealStrategy::NoFocus` or `RevealStrategy::Never`. Previously, terminals would still receive focus if the terminal pane already had focus, contradicting the documented behavior. ## Changes - **`add_terminal_task()`**: Changed focus logic to only focus when `RevealStrategy::Always` - **`add_terminal_shell()`**: Same fix The fix changes: ```rust // Before let focus = pane.has_focus(window, cx) || matches!(reveal_strategy, RevealStrategy::Always); // After let focus = matches!(reveal_strategy, RevealStrategy::Always); ``` ## Impact This affects: - Vim users running `:!command` (uses `NoFocus`) - Debugger terminal spawning (uses `NoFocus`) - Any programmatic terminal creation requesting background behavior Release Notes: - Fixed terminal focus behavior to respect `RevealStrategy::NoFocus` and `RevealStrategy::Never` settings when the terminal pane already has focus.
LivioGama
pushed a commit
to LivioGama/zed
that referenced
this pull request
Jan 20, 2026
…ed-industries#45180) Closes zed-industries#45179 ## Summary Fixes the focus behavior when creating terminals with `RevealStrategy::NoFocus` or `RevealStrategy::Never`. Previously, terminals would still receive focus if the terminal pane already had focus, contradicting the documented behavior. ## Changes - **`add_terminal_task()`**: Changed focus logic to only focus when `RevealStrategy::Always` - **`add_terminal_shell()`**: Same fix The fix changes: ```rust // Before let focus = pane.has_focus(window, cx) || matches!(reveal_strategy, RevealStrategy::Always); // After let focus = matches!(reveal_strategy, RevealStrategy::Always); ``` ## Impact This affects: - Vim users running `:!command` (uses `NoFocus`) - Debugger terminal spawning (uses `NoFocus`) - Any programmatic terminal creation requesting background behavior Release Notes: - Fixed terminal focus behavior to respect `RevealStrategy::NoFocus` and `RevealStrategy::Never` settings when the terminal pane already has focus.
LivioGama
pushed a commit
to LivioGama/zed
that referenced
this pull request
Jan 20, 2026
…ed-industries#45180) Closes zed-industries#45179 ## Summary Fixes the focus behavior when creating terminals with `RevealStrategy::NoFocus` or `RevealStrategy::Never`. Previously, terminals would still receive focus if the terminal pane already had focus, contradicting the documented behavior. ## Changes - **`add_terminal_task()`**: Changed focus logic to only focus when `RevealStrategy::Always` - **`add_terminal_shell()`**: Same fix The fix changes: ```rust // Before let focus = pane.has_focus(window, cx) || matches!(reveal_strategy, RevealStrategy::Always); // After let focus = matches!(reveal_strategy, RevealStrategy::Always); ``` ## Impact This affects: - Vim users running `:!command` (uses `NoFocus`) - Debugger terminal spawning (uses `NoFocus`) - Any programmatic terminal creation requesting background behavior Release Notes: - Fixed terminal focus behavior to respect `RevealStrategy::NoFocus` and `RevealStrategy::Never` settings when the terminal pane already has focus.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #45179
Summary
Fixes the focus behavior when creating terminals with
RevealStrategy::NoFocusorRevealStrategy::Never. Previously, terminals would still receive focus if the terminal pane already had focus, contradicting the documented behavior.Changes
add_terminal_task(): Changed focus logic to only focus whenRevealStrategy::Alwaysadd_terminal_shell(): Same fixThe fix changes:
Impact
This affects:
:!command(usesNoFocus)NoFocus)Release Notes:
RevealStrategy::NoFocusandRevealStrategy::Neversettings when the terminal pane already has focus.