Skip to content

feat(tabs): add CycleMostRecentTab as third Ctrl+Tab behavior option#9658

Open
Akeuuh wants to merge 10 commits intowarpdotdev:masterfrom
Akeuuh:axel/ctrl-tab-mru-tabs
Open

feat(tabs): add CycleMostRecentTab as third Ctrl+Tab behavior option#9658
Akeuuh wants to merge 10 commits intowarpdotdev:masterfrom
Akeuuh:axel/ctrl-tab-mru-tabs

Conversation

@Akeuuh
Copy link
Copy Markdown
Contributor

@Akeuuh Akeuuh commented Apr 30, 2026

Summary

Adds a new CycleMostRecentTab option to the Ctrl+Tab behavior settings, allowing users to cycle through tabs by most-recently-used order using the existing ctrl_tab palette UI.

Validation

image
Enregistrement.de.l.ecran.2026-05-04.a.09.09.12.mov

What changed

  • New CtrlTabBehavior variant: CycleMostRecentTab added as a third option alongside ActivatePrevNextTab and CycleMostRecentSession
  • MRU tracking: Workspace tracks tab activation order via tab_mru_order: Vec<EntityId>, updated in set_active_tab_index()
  • Tabs data source: New search/command_palette/tabs/ module with DataSource (provides MRU-ordered tabs) and SearchItem (renders two-row layout: bold title + gray CWD subtitle)
  • Palette wiring: QueryFilter::Tabs, NavigateToTab action, reset_ctrl_tab_mixer() for tabs-only palette mode
  • Activation: root_view handles activate_tab_by_pane_group_id action to switch to the selected tab
  • Settings UI: Third dropdown option in Features settings page
  • Offset fix: set_initial_selection_offset now called before set_active_query_filter to fix pre-selection for synchronous data sources

Files changed (16 files, +435/-7)

File Change
settings/mod.rs CycleMostRecentTab enum variant
settings_view/features_page.rs Third dropdown option
session_management.rs TabNavigationData struct with subtitle
workspace/view.rs MRU tracking, tab_navigation_data(), palette opening logic
workspace/view_test.rs test_tab_mru_order unit test
search/data_source.rs QueryFilter::Tabs variant
search/filter_chip_renderer.rs Tabs filter chip
search/command_palette/tabs/ New module: mod.rs, data_source.rs, search_item.rs
search/command_palette/data_sources.rs reset_ctrl_tab_mixer(), ItemSummary::Tab
search/command_palette/mixer.rs NavigateToTab action
search/command_palette/view.rs NavigateToTab handler
search/command_palette/filter_chip_renderer.rs Tabs filter support
root_view.rs activate_tab_by_pane_group_id action handler

How to test

  1. Open Warp → Settings → Features → "Ctrl-Tab behavior" → select "Cycle Most Recent Tab"
  2. Open 3+ tabs, switch between them
  3. Press Ctrl+Tab → palette opens with tabs in MRU order, 2nd item pre-selected
  4. Release Ctrl → switches to selected tab
  5. Each item shows tab title (bold) + working directory (gray)

@cla-bot cla-bot Bot added the cla-signed label Apr 30, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented Apr 30, 2026

@Akeuuh

I ran into an unexpected error while working on this.

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and posted feedback on this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

oz-for-oss[bot]
oz-for-oss Bot previously requested changes Apr 30, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a CycleMostRecentTab Ctrl+Tab behavior with MRU tab tracking, a tabs-only command palette data source, action wiring, and settings UI support.

Concerns

  • The selection-offset ordering change applies to the existing synchronous sessions Ctrl+Tab path as well as the new tabs path, causing CycleMostRecentSession to advance twice on first open.
  • Security pass found no additional concerns.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/workspace/view.rs Outdated
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented Apr 30, 2026

/oz-review

oz-for-oss[bot]
oz-for-oss Bot previously requested changes Apr 30, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a new Ctrl+Tab behavior that should present tabs in most-recently-used order through the command palette UI, with supporting MRU tracking, a tabs data source, and settings UI wiring.

Concerns

  • The new tabs palette path appears to run its synchronous query before the Workspace action handler returns, so the weak workspace handle can fail to upgrade and the palette opens with no tab results.
  • After the tabs-only mixer is installed, switching the Ctrl+Tab setting back to session cycling does not restore the session data source for the Ctrl+Tab palette.
  • Security pass: no security-specific issues found in the inlined diff.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/workspace/view.rs Outdated
Comment thread app/src/workspace/view.rs Outdated
oz-for-oss[bot]
oz-for-oss Bot previously requested changes Apr 30, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a third Ctrl+Tab behavior that cycles tabs by workspace MRU order, with new tab navigation data, a tabs command-palette data source, and settings UI wiring. The supplemental security pass did not identify security findings tied to the diff.

Concerns

  • The new tabs data source is queried synchronously while Workspace::open_ctrl_tab_palette is still executing inside a workspace update. Because it upgrades a weak handle back to the same workspace at that point, the initial tabs query can return empty results and the new Ctrl+Tab behavior fails to show/select tabs.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/search/command_palette/tabs/data_source.rs Outdated
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented Apr 30, 2026

/oz-review

oz-for-oss[bot]
oz-for-oss Bot previously requested changes Apr 30, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a third Ctrl+Tab behavior that opens a tabs-only navigation palette ordered by most-recently-used tab activation, plus settings UI and tab metadata rendering.

Concerns

  • Tab palette selections are still enqueued into the shared command-palette recent-items store, but Tab summaries intentionally cannot be reconstructed for recent items. Repeated Ctrl+Tab use can therefore fill the bounded recent queue with invisible entries and evict useful command/session recents.
  • Supplemental security pass: no security issues identified in the inlined diff.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/search/command_palette/data_sources.rs
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented May 1, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 1, 2026

@Akeuuh

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 1, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a third Ctrl-Tab behavior that opens a tabs-only navigation palette backed by MRU tab tracking, plus the settings/UI/data-source plumbing needed to render and activate tab results.

Concerns

  • The new tabs search item imports SingletonEntity without using it, which should be removed before the presubmit clippy gate.
  • No security findings were identified in the changed diff.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/search/command_palette/tabs/search_item.rs
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented May 1, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 1, 2026

@Akeuuh

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 1, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a third Ctrl-Tab behavior that opens a tabs-only navigation palette ordered by most-recently-used tabs, along with settings UI, data-source wiring, MRU tracking, and activation handling.

Concerns

  • UI evidence is missing for this user-visible change. The diff changes settings copy and adds a new two-line tab palette row, but the provided PR context has no screenshot or video demonstrating the settings option and Ctrl-Tab tab-switcher flow end to end.
  • Security pass: no security concerns were identified in the changed lines.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/search/command_palette/tabs/search_item.rs
@Akeuuh Akeuuh force-pushed the axel/ctrl-tab-mru-tabs branch from 4c6526c to f4e1772 Compare May 1, 2026 20:43
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented May 2, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 2, 2026

@Akeuuh

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @acarl005.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot dismissed stale reviews from themself May 2, 2026 06:06

Oz no longer requests changes for this pull request after the latest automated review.

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

This PR adds a Ctrl+Tab behavior that uses a tabs-only command palette backed by workspace tab MRU order, with settings UI wiring and tab activation support.

Concerns

  • The tab palette displays each tab's working directory but only searches tab titles, so the visible subtitle cannot be used to disambiguate or find tabs.

Verdict

Found: 0 critical, 0 important, 1 suggestions

Approve with nits

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/search/command_palette/tabs/data_source.rs Outdated
@oz-for-oss oz-for-oss Bot requested a review from acarl005 May 2, 2026 06:07
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented May 2, 2026

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 2, 2026

@Akeuuh

I'm re-reviewing this pull request in response to a review request.

You can view the conversation on Warp.

I reviewed this pull request and requested human review from: @acarl005.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

Overview

Adds a third Ctrl+Tab behavior that opens a tabs-only navigation palette backed by MRU tab ordering, plus the settings dropdown entry and tab palette rendering.

Concerns

  • No blocking correctness or security concerns found in the annotated diff.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@acarl005 acarl005 left a comment

Choose a reason for hiding this comment

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

Thanks @Akeuuh, I dig this idea!

Before I review the code in depth, I want to discuss the UI. The only problem is that there are cases where the palette items can look identical. I'd like to propose a way to distinguish when tabs have the same title + subtitle. Can you prefix the title with something like "[Tab N] " where N is a 1-based index from left-to-right? That way tabs are always unambiguous.

I suppose that is also a problem with the session-based ctrl+tab, but those items don't have a straightforward numbering sequence so we'll just have to accept that.

Also, I appreciate the video you have posted. Can you also include a screenshot of the palette for quicker reference?

I left a couple of comments on code requesting changes but I'll do a more in-depth review once the above is addressed.

Comment thread app/src/search/command_palette/tabs/search_item.rs Outdated
Comment thread app/src/search/command_palette/tabs/search_item.rs Outdated
@Akeuuh Akeuuh force-pushed the axel/ctrl-tab-mru-tabs branch from dc38523 to 0068345 Compare May 4, 2026 07:19
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented May 4, 2026

@acarl005 Thanks for the review! I've addressed both code comments:

  • SearchItem trait import: now imported and used with a short alias instead of the fully-qualified path
  • Icon color: switched to highlight_state.icon_fill(appearance) for proper contrast handling
  • [Tab N] prefix: tab titles now display as [Tab N] title (1-based, left-to-right) so tabs with identical names are always distinguishable

I've also updated the PR description with a new video and a screenshot of the palette. Ready for your in-depth review whenever you are!

@Akeuuh Akeuuh requested a review from acarl005 May 4, 2026 11:23
Comment thread app/src/search/command_palette/tabs/search_item.rs Outdated
Comment thread app/src/search/command_palette/tabs/search_item.rs Outdated
Comment thread app/src/workspace/view.rs Outdated
Comment thread app/src/workspace/view.rs
Comment thread app/src/workspace/view.rs Outdated
Comment thread app/src/workspace/view.rs Outdated
Comment thread app/src/workspace/view.rs Outdated
Comment thread app/src/search/command_palette/view.rs Outdated
Comment thread app/src/search/data_source.rs Outdated
Comment thread app/src/search/command_palette/tabs/search_item.rs
@Akeuuh Akeuuh requested a review from acarl005 May 5, 2026 10:06
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented May 5, 2026

Thanks for the thorough review @acarl005! All your comments have been addressed in the latest push:

  • search_item.rs: is_multiline() now checks for subtitle presence (fixes settings tab), added doc comment on the struct, accessibility message includes actual tab title
  • workspace/view.rs: tab_mru_order() is #[cfg(test)]-gated, removed unnecessary pub on activate_tab_by_pane_group_id (→ pub(crate)) and tab_navigation_data (→ fn), merged the CycleMostRecentSession/CycleMostRecentTab arms while preserving behavior difference, removed redundant tab_mru_order.push(), replaced if/else with match on QueryFilter for exhaustiveness, removed extra blank line
  • view.rs: reworded the recents-exclusion comment per your suggestion
  • data_source.rs: Tabs filter atom → NO_FILTER_ATOM, removed the unused TABS_FILTER_ATOM definition

Let me know if anything else needs adjusting!

Copy link
Copy Markdown
Contributor

@acarl005 acarl005 left a comment

Choose a reason for hiding this comment

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

Regarding this comment:

#9658 (comment)

That wasn't the only instance. There are several other methods in the same file that have the same issue (redundant updates to self.tab_mru_order). We should rely on fn set_active_tab_index as the single source of truth for keeping self.tab_mru_order in sync. Please clean those up as well. After that (and dealing with any CI issues), this should be ready to merge.

@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented May 5, 2026

@acarl005 Thanks for the review! Addressed in d99967d:

  • Removed all redundant tab_mru_order pushes — set_active_tab_index is now the single source of truth for MRU tracking
  • Also resolved the merge conflict and ran cargo fmt

Should be good to go once CI passes.

@Akeuuh Akeuuh requested a review from acarl005 May 5, 2026 22:40
Akeuuh added 9 commits May 6, 2026 09:48
Add a new CtrlTabBehavior::CycleMostRecentTab option that cycles through
tabs by most-recently-used order via the existing ctrl_tab palette.

- Track tab MRU order in Workspace via tab_mru_order Vec<EntityId>
- Add QueryFilter::Tabs and tabs data source module (data_source, search_item)
- Wire NavigateToTab action through mixer, palette view, and root_view
- Show tab title (bold) + working directory subtitle (gray) in palette
- Add CycleMostRecentTab to settings dropdown as third option
- Fix palette pre-selection offset for sync data sources
- Guard select_next/prev to only fire when palette already open;
  on first open, set_initial_selection_offset(1) handles pre-selection
- Assign descending scores by MRU rank (1000 - rank) so TopDown
  rendering preserves most-recently-used order
- Update tab_mru_order in adopt_transferred_pane_group when
  placeholder pane group is replaced with transferred one
The offset-before-filter ordering is only needed for QueryFilter::Tabs
(synchronous data source). Applying it unconditionally caused
CycleMostRecentSession to double-advance on first Ctrl+Tab.

Also applies cargo fmt to all new code.
Bug 1: tabs::DataSource held WeakViewHandle<Workspace> but run_query
executes while workspace is borrowed (inside update_view), so upgrade()
returns None and palette opens empty. Fix: pre-compute tab snapshot in
open_ctrl_tab_palette and pass Vec<TabNavigationData> to DataSource.

Bug 2: reset_ctrl_tab_mixer wipes all mixer sources via mixer.reset()
then adds only tabs. Switching back to CycleMostRecentSession never
restored sessions source. Fix: add restore_ctrl_tab_session_mixer that
resets mixer and re-adds sessions_data_source.
NavigateToTab actions are transient Ctrl+Tab selections — recording them
in SelectedItems evicts real recent items over repeated use.
- search_item: fix is_multiline for tabs without subtitle (e.g. settings)
- search_item: add doc comment explaining ctrl-tab-only design
- search_item: include tab title in accessibility_help_message
- workspace: cfg(test) guard on tab_mru_order(), reduce pub visibility
- workspace: merge CycleMostRecentSession/Tab arms, preserve behavior diff
- workspace: remove redundant tab_mru_order push (set_active_tab_index handles it)
- workspace: replace if/else with match on QueryFilter for exhaustiveness
- workspace: remove extra blank line
- view: reword transient actions comment per reviewer suggestion
- data_source: replace TABS_FILTER_ATOM with NO_FILTER_ATOM (tabs not in main palette)
set_active_tab_index is the single source of truth for MRU tracking.
Remove manual pushes that duplicated the update before activate_tab_internal.
Also remove unused SingletonEntity import and apply formatting.
@Akeuuh Akeuuh force-pushed the axel/ctrl-tab-mru-tabs branch 4 times, most recently from 7dc7bde to 97f57ad Compare May 6, 2026 09:20
@Akeuuh Akeuuh force-pushed the axel/ctrl-tab-mru-tabs branch from 97f57ad to cf8c606 Compare May 6, 2026 09:22
@Akeuuh
Copy link
Copy Markdown
Contributor Author

Akeuuh commented May 6, 2026

Hey @acarl005, the CI hasn't been triggered yet on this PR (fork PR, needs manual approval). Could you kick it off? The presubmit issues that were flagged should now be fixed — the recent commits address the compilation errors and clippy warnings from the rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants