# pane: Apply \`max_tabs\` change immediately \(\#32447\) · gitcafe/zed

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

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

Visibility: public

Requested revision: d1ca6db7561ecd75f068a4dd306d1904c0415aec

Requested commit: d1ca6db7561ecd75f068a4dd306d1904c0415aec

Commit: d1ca6db7561ecd75f068a4dd306d1904c0415aec

Tree: f719fd73ec101d012c2d9f8b51f3f0fd4cc36ece

Author: vipex

Committer: GitHub

## Message

```
pane: Apply `max_tabs` change immediately (#32447)

Closes #32217

Follow up of https://github.com/zed-industries/zed/pull/32301, sorry
about the messy rebase in the previous PR.

Release Notes: 
- Fixed `max_tabs` setting not applying immediately when changed
 
TODO: 
- [x] Fix the off-by-one bug (currently closing one more tab than the
max_tabs setting) while perserving "+1 Tab Allowance" feature.
- [x] Investigate Double Invocation of `settings_changed`
- [x] Write test that:
  - Sets max_tabs to `n`
  - Opens `n` buffers
  - Changes max_tabs to `n-1`
  - Asserts we have exactly `n-1` buffers remaining

---------

Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
```

## Parents

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

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