Skip to content

workspace: Allow disabling tab cycles when using keyboard navigation#51253

Merged
dinocosta merged 3 commits intozed-industries:mainfrom
winzamark123:add-clamp-to-tab-navigation
Mar 31, 2026
Merged

workspace: Allow disabling tab cycles when using keyboard navigation#51253
dinocosta merged 3 commits intozed-industries:mainfrom
winzamark123:add-clamp-to-tab-navigation

Conversation

@winzamark123
Copy link
Copy Markdown
Contributor

@winzamark123 winzamark123 commented Mar 11, 2026

Hi I've wanted this feature and looked through most open issues and pull request and couldn't find an implementation! Currently keymap of pane::ActivatePreviousItem or pane::ActivateNextItem will cycle through the tab when it reaches the end (either the start or the beginning). This PR allows the user to set whether they want to "clamp" it so that it doesn't cycle.

Heres a video of before and after when the keyboard short cut has been set. Let me know if this needs more clarifying.

zed-wrap.mp4

Summary

  • Adds an optional wrap_around field to ActivatePreviousItem and ActivateNextItem pane actions
  • When wrap_around: false, tab navigation stops at the first/last tab instead of wrapping circularly
  • Defaults to true, fully preserving existing behavior

Usage

Taking the current default macOS keymap, one could update the current behavior with the following bindings:

{
    "context": "Pane",
    "use_key_equivalents": true,
    "bindings": {
      "alt-cmd-left": ["pane::ActivatePreviousItem", { "wrap_around": false }],
      "cmd-{": ["pane::ActivatePreviousItem", { "wrap_around": false }],
      "alt-cmd-right": ["pane::ActivateNextItem", { "wrap_around": false }],
      "cmd-}": ["pane::ActivateNextItem", { "wrap_around": false }],
    },
  }

Test plan

  • Added test_activate_item_with_clamp in crates/workspace/src/pane.rs covering:
    • clamp: true at last tab stays on last tab
    • clamp: true at first tab stays on first tab
    • Default behavior (wrapping) unchanged
    • Normal mid-list navigation works with clamp
  • Existing tests pass (cargo test -p workspace, cargo test -p tab_switcher)
  • Tested locally: default keybindings still wrap, custom clamp: true bindings stop at boundaries

Release Notes:

  • Added a wrap_around option to both pane::ActivatePreviousItem and pane::ActivateNextItem actions to optionally disable wrapping when cycling past the first or last tab.

Add an optional `clamp` field to `ActivatePreviousItem` and
`ActivateNextItem` actions. When `clamp` is true, tab navigation
stops at the first/last tab instead of wrapping circularly.
Defaults to false, preserving existing behavior.

Usage in keymap.json:
  "ctrl-h": ["pane::ActivatePreviousItem", { "clamp": true }]
  "ctrl-l": ["pane::ActivateNextItem", { "clamp": true }]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 11, 2026
@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Mar 11, 2026
@winzamark123 winzamark123 changed the title workspace: Add clamp parameter to tab navigation actions workspace: Allowing user to disable tab cycles when using keyboard navigation Mar 11, 2026
Copy link
Copy Markdown
Member

@dinocosta dinocosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @winzamark123 👋

I've checked out your changes and everything seems to be working, implementation also seems fine and appreciate you including tests for the introduced changes!

Will share with the team to see if there's an interest in introducing this. Will keep you posted 🙂

@dinocosta dinocosta added the area:navigation Feedback for workspace navigation, breadcrumbs, definitions, files, panels, etc label Mar 11, 2026
@dinocosta dinocosta self-assigned this Mar 11, 2026
@maxdeviant maxdeviant changed the title workspace: Allowing user to disable tab cycles when using keyboard navigation workspace: Allow disabling tab cycles when using keyboard navigation Mar 11, 2026
@winzamark123
Copy link
Copy Markdown
Contributor Author

Thank you for the fast review @dinocosta ! Really appreciate what you guys have done / are doing with Zed.

Looking forward to hearing back :3

@winzamark123
Copy link
Copy Markdown
Contributor Author

Hey @dinocosta just checking in on this, did the team have a chance to follow up? Let me know if theres anything i can do to move this along!

Rename the field for both `workspace::pane::ActivatePreviousItem` and
`workspace::pane::ActivateNextItem` actions from `clamp` to
`wrap_around` and default it to true, keeping the current default
behavior.
Copy link
Copy Markdown
Member

@dinocosta dinocosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @winzamark123! 👋

Sorry for the slow response, I’ve been busy with other pull requests. I didn’t get much feedback from the team, but since this is a fairly small change with a limited surface area for errors, I think we’re fine to go ahead and introduce it.

I’ve renamed the ‎clamp field to ‎wrap_around, as I think it’s a bit clearer from a user-facing perspective. 🙂

@dinocosta dinocosta enabled auto-merge (squash) March 31, 2026 11:08
@dinocosta dinocosta merged commit f548125 into zed-industries:main Mar 31, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:navigation Feedback for workspace navigation, breadcrumbs, definitions, files, panels, etc cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants