# terminal: Respect RevealStrategy::NoFocus and Never focus settings \(\#45180\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5488a19221aa487d81020fcbb93efcf42b52e6fa)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5488a19221aa487d81020fcbb93efcf42b52e6fa

Requested commit: 5488a19221aa487d81020fcbb93efcf42b52e6fa

Commit: 5488a19221aa487d81020fcbb93efcf42b52e6fa

Tree: 6aa1766b84f934f92623b851c4991ce83fccca62

Author: rabsef-bicrym

Committer: GitHub

## Message

````
terminal: Respect RevealStrategy::NoFocus and Never focus settings (#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.
````

## Parents

- [bb1198e7d60de7510dcd10c400f5ae205835da5c](https://git.cafe/gitcafe/zed/commit/bb1198e7d60de7510dcd10c400f5ae205835da5c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5488a19221aa487d81020fcbb93efcf42b52e6fa?format=markdown)
