# vim: Fix visual block handling of wrapped lines \(\#39355\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 8441aa49b23b4c09dba32819d5271d001698f656

Requested commit: 8441aa49b23b4c09dba32819d5271d001698f656

Commit: 8441aa49b23b4c09dba32819d5271d001698f656

Tree: 3f7f68616aea6aac996cf62670a977c8cbff7590

Author: Dino

Committer: GitHub

## Message

````
vim: Fix visual block handling of wrapped lines (#39355)

These changes fix an issue with vim's visual block mode when soft
wrapping is enabled. In this situation, if one was to move the cursor
either up or down, the selection would be updated to include visual
(wrapped) rows, instead of only the buffer rows. For example, take the
following contents:

```
1 | And here's a very long line that is wrapping
    at this exact point.
2 | And another very long line that is will also
    wrap at this exact point.
```

If one was to place the cursor at the start of the first line, character
`A`, trigger visual block mode with `ctrl-v` and then move down one line
with `j`, the selection would end up as (with [X] representing the
selected characters):

```
1 | [A]nd here's a very long line that is wrapping
    [a]t this exact point.
2 | [A]nd another very long line that is will also
    wrap at this exact point.
```

Instead of the expected:

```
1 | [A]nd here's a very long line that is wrapping
    at this exact point.
2 | [A]nd another very long line that is will also
    wrap at this exact point.
```

With the changes in this commit, `Vim.visual_block_motion` will now
leverage buffer rows in order to navigate to the next or previous row.

Release Notes:

- Fixed handling of soft wrapped lines in vim's visual block mode
````

## Parents

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

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