# workspace: Add action to move focused panel to next dock position \(\#23317\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 0ff803fe10dc4b9a33390fe9a4c8a9304ba6b2af

Requested commit: 0ff803fe10dc4b9a33390fe9a4c8a9304ba6b2af

Commit: 0ff803fe10dc4b9a33390fe9a4c8a9304ba6b2af

Tree: 7c9de0735799c241cf208e1854a3dfa50d248831

Author: Dino

Committer: GitHub

## Message

```
workspace: Add action to move focused panel to next dock position (#23317)

This Pull Request introduces a new command `workspace: move focused
panel to next position` which finds the currently focused panel, if such
panel exists, and moves it to the next valid dock position, following
the order of `Left → Bottom → Right` and then starting again from the
left position.

In order to achieve this the following changes have been introduced:

* Add a new default implementation for `PanelHandle`, namely
`PanelHandle::move_to_next_position` which leverages
`PanelHandle::position`, `PanelHandle::position_is_valid` and
`PanelHandle::set_position` methods to update the panel's position to
the next valid position.
* Add a new method to the `workspace` module, `
move_focused_panel_to_next_position`, which is responsible for finding
the currently focused panel, if such a panel exists, and calling the
`move_to_next_position` method in the panel's handle.
* Add a new action to the `workspace` module,
`MoveFocusedPanelToNextPosition`, which is handled by the
`move_focused_panel_to_next_position` method.

Tests have also been added to the `workspace` module in order to
guarantee that the action is correctly updating the focused panel's
position.

Here's a quick video of it, in action 🔽 


https://github.com/user-attachments/assets/264d382b-5239-40aa-bc5e-5d569dec0734

Closes #23115 

Release Notes:

- Added new command to move the focused panel to the next valid dock
position – `workspace: move focused panel to next position` .
```

## Parents

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

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