Skip to content

workspace: Add workspace::FocusCenterPane#46059

Merged
Veykril merged 1 commit intozed-industries:mainfrom
FloppyDisco:workspace-focus-center-panes-action
Mar 18, 2026
Merged

workspace: Add workspace::FocusCenterPane#46059
Veykril merged 1 commit intozed-industries:mainfrom
FloppyDisco:workspace-focus-center-panes-action

Conversation

@FloppyDisco
Copy link
Copy Markdown
Contributor

solution for #43004

Release Notes:

  • Added workspace::FocusCenterPane

The editor::ToggleFocus action not working really drives me bonkers, and it also doesn't really make sense, because it doesn't toggle anything. it moves focus, but doesn't move focus back anywhere if you run it again so 'ToggleFocus' seems misleading.

Here we have added an action that just moves focus to the most recent center pane: workspace::FocusCenterPane

this action correctly moves the focus to the center pane from any dock, even if the center pane is the project diff, branch diff, terminal, or keymap editor, etc.

i'm not sure if this would be considered a 'replacement' for editor::ToggleFocus but i do think this is probably more in line with what most users would consider the expected behavior.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 5, 2026
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Jan 5, 2026
@JosephTLyons JosephTLyons removed the request for review from maxdeviant January 6, 2026 16:23
@alexey-drozd
Copy link
Copy Markdown

Hi, this seems like a very nice feature. What's left to do here?

@FloppyDisco
Copy link
Copy Markdown
Contributor Author

hey @maxdeviant let me know if there is anything to do for this one.

if let Some(item) = self.active_item(cx) {
item.item_focus_handle(cx).focus(window, cx);
} else {
log::error!("Could not find a focus target when switching focus to the center panes",);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This log doesn't really serve any purpose I think, let's remove it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Veykril
happy to remove this, i just wanted to double check first though.
I copied this structure from activate_pane_in_direction().

item.item_focus_handle(cx).focus(window, cx);

Just trying to follow what was already in the codebase, let me know if you would still like me to take it out!

@Veykril Veykril assigned Veykril and unassigned maxdeviant Mar 17, 2026
@FloppyDisco FloppyDisco force-pushed the workspace-focus-center-panes-action branch from 7c69bb5 to e0c6628 Compare March 17, 2026 19:42
@FloppyDisco
Copy link
Copy Markdown
Contributor Author

rebased.
because this branch was 2200 commits behind main. lol.

Copy link
Copy Markdown
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

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

Thanks!

@Veykril Veykril changed the title Add workspace::FocusCenterPane workspace: Add workspace::FocusCenterPane Mar 18, 2026
@Veykril Veykril enabled auto-merge (squash) March 18, 2026 06:13
@Veykril Veykril merged commit 695e8a9 into zed-industries:main Mar 18, 2026
30 checks passed
AmaanBilwar pushed a commit to AmaanBilwar/zed that referenced this pull request Mar 20, 2026
solution for zed-industries#43004

Release Notes:

- Added workspace::FocusCenterPane


The `editor::ToggleFocus` action not working really drives me bonkers,
and it also doesn't really make sense, because it doesn't toggle
anything. it moves focus, but doesn't move focus back anywhere if you
run it again so 'ToggleFocus' seems misleading.

Here we have added an action that just moves focus to the most recent
center pane: `workspace::FocusCenterPane`

this action correctly moves the focus to the center pane from any dock,
even if the center pane is the project diff, branch diff, terminal, or
keymap editor, etc.

i'm not sure if this would be considered a 'replacement' for
`editor::ToggleFocus` but i do think this is probably more in line with
what most users would consider the expected behavior.
@FloppyDisco FloppyDisco deleted the workspace-focus-center-panes-action branch March 23, 2026 19:19
AmaanBilwar pushed a commit to AmaanBilwar/zed that referenced this pull request Mar 23, 2026
solution for zed-industries#43004

Release Notes:

- Added workspace::FocusCenterPane


The `editor::ToggleFocus` action not working really drives me bonkers,
and it also doesn't really make sense, because it doesn't toggle
anything. it moves focus, but doesn't move focus back anywhere if you
run it again so 'ToggleFocus' seems misleading.

Here we have added an action that just moves focus to the most recent
center pane: `workspace::FocusCenterPane`

this action correctly moves the focus to the center pane from any dock,
even if the center pane is the project diff, branch diff, terminal, or
keymap editor, etc.

i'm not sure if this would be considered a 'replacement' for
`editor::ToggleFocus` but i do think this is probably more in line with
what most users would consider the expected behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants