# editor: Fix add selection when skipping over soft-wrapped lines \(\#46911\) · gitcafe/zed

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

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

Visibility: public

Requested revision: edae88c223fafa174288bdf112becf1cecf7837e

Requested commit: edae88c223fafa174288bdf112becf1cecf7837e

Commit: edae88c223fafa174288bdf112becf1cecf7837e

Tree: fc328e27edee23ea3472511eb8b5d6c76356a134

Author: Dino

Committer: GitHub

## Message

```
editor: Fix add selection when skipping over soft-wrapped lines (#46911)

Fixes an issue where `editor::AddSelectionAbove` and
`editor::AddSelectionBelow`, when set with `skip_soft_wrap: true` ,
would lose track of the original cursor column when passing through
short lines, as `editor::Editor.add_selection` was not using the oldest
selection's column range when adding a new selection.

These changes update the `editor::Editor.add_selection` method so as to
keep track of the olde selection's column range for each group, as well
as extracting `find_next_columnar_selection_by_display_row` and
`find_next_columnar_selection_by_buffer_row` helper methods to clarify
the two navigation strategies.

Closes #46842

Release Notes:

- Fixed `editor::AddSelectionAbove` and `editor::AddSelectionBelow` when
skipping over soft-wrapped lines to preserve the original cursor column
when adding selections through lines shorter than the starting position
```

## Parents

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

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