# Correct other end visual block functionality \(\#27678\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 5c0adde7bb5e0d7dff6e6dbaa301d5d4a0c8f52c

Requested commit: 5c0adde7bb5e0d7dff6e6dbaa301d5d4a0c8f52c

Commit: 5c0adde7bb5e0d7dff6e6dbaa301d5d4a0c8f52c

Tree: e41e3bf69587870aa24e76861800c722993b2ddc

Author: Peter Finn

Committer: GitHub

## Message

```
Correct other end visual block functionality (#27678)

Closes #27385

Builds on #27604 so that `vim::OtherEnd` works in visual block mode.
This is accomplished by reversing the order of active selections in the
buffer when the user hit `o`, so that the cursor moves diagonally across
the selection. The current behavior is preserved for `shift-o`, which is
how the cursors behave in vim.

We'll close #27604 since this encapsulates that change, but if you'd
prefer to take only the visual block motion component, we'll keep the
branch for #27604 open.

Test case: growing a box down and to the right, other ending, followed
by growing and shrinking the box:


https://github.com/user-attachments/assets/1df544e1-efce-4354-b354-bbfec007a7df

Test case: growing a box up and to the left, other ending, followed by
growing and shrinking the box:


https://github.com/user-attachments/assets/2f6d7729-c63a-4486-960b-23474c2e507a



Release Notes:
- Improved visual block mode when cursor is at beginning of selection
- Improved visual block mode so that `o` and `shift-o` reach parity with
vim

---------

Co-authored-by: KyleBarton <kjbarton4@gmail.com>
```

## Parents

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

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