# Ensure \`pane: swap item right\` does not panic \(\#36765\) · gitcafe/zed

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

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

Visibility: public

Requested revision: e6267c42f70233542f09429337d688cc96ceee90

Requested commit: e6267c42f70233542f09429337d688cc96ceee90

Commit: e6267c42f70233542f09429337d688cc96ceee90

Tree: 6f71981a455e947e3ffb6271a0b268617fcec0aa

Author: Finn Evers

Committer: GitHub

## Message

```
Ensure `pane: swap item right` does not panic (#36765)

This fixes a panic I randomly ran into whilst mistyping in the command
palette: I accidentally ran `pane: swap item right`in a state where no
items were opened in my active pane. We were checking for `index + 1 ==
self.items.len()` there when it really should be `>=`, as otherwise in
the case of no items this panics.

This PR fixes the bug, adds a test for both the panic as well as the
actions themselves (they were untested previously). Lastly (and mostly),
this also cleans up a bit around existing actions to update them with
how we generally handle actions now.

Release Notes:

- Fixed a panic that could occur with the `pane: swap item right`
action.
```

## Parents

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

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