# editor: Add multi cursor support for \`AddSelectionAbove\`/\`AddSelectionBelow\` \(\#32204\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 6a8fdbfd62eb33c9c20c8a00b7e9685414cbd758

Requested commit: 6a8fdbfd62eb33c9c20c8a00b7e9685414cbd758

Commit: 6a8fdbfd62eb33c9c20c8a00b7e9685414cbd758

Tree: ca30209b99ea077b0eee8b31d299387ed6cb1a0e

Author: Smit Barmase

Committer: GitHub

## Message

```
editor: Add multi cursor support for `AddSelectionAbove`/`AddSelectionBelow` (#32204)

Closes #31648

This PR adds support for:
- Expanding multiple cursors above/below
- Expanding multiple selections above/below
- Adding new cursors/selections when expansion has already been done.
Existing expansions preserve their state and expand/shrink according to
the action, while new cursors/selections act like freshly created ones.

Tests for both cursor and selections:
- below/above cases
- undo/redo cases
- adding new cursors/selections with existing expansion

Before/After:


https://github.com/user-attachments/assets/d2fd556b-8972-4719-bd86-e633d42a1aa3


Release Notes:

- Improved `AddSelectionAbove` and `AddSelectionBelow` to extend
multiple cursors/selections.
```

## Parents

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

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