Skip to content

User buffer column range when adding selection that skips soft wrap#45594

Merged
dinocosta merged 1 commit intomainfrom
42137-add-selection-soft-wrap
Jan 5, 2026
Merged

User buffer column range when adding selection that skips soft wrap#45594
dinocosta merged 1 commit intomainfrom
42137-add-selection-soft-wrap

Conversation

@dinocosta
Copy link
Member

When adding selections above/below with skip_soft_wrap: true, use buffer column positions instead of pixel positions. This ensures selections are placed at the same column offset in the buffer rather than at the same visual position, which was incorrect for soft-wrapped lines.

For example, selecting "how" in a wrapped line:

1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show how a wrapped
   line would look

Now correctly adds a selection at the same buffer column in the next line:

1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show [how] a wrapped
   line would look

Closes #42137

Release Notes:

  • Improved editor: add selection above and editor: add selection below to select at the same text column when skipping soft-wrapped lines, instead of the same visual position

When adding selections above/below with `skip_soft_wrap: true`, use buffer
column positions instead of pixel positions. This ensures selections are
placed at the same column offset in the buffer rather than at the same
visual position, which was incorrect for soft-wrapped lines.

For example, selecting "how" in a wrapped line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show how a wrapped
   line would look
````

Now correctly adds a selection at the same buffer column in the next
line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show [how] a wrapped
   line would look
````
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 23, 2025
@dinocosta dinocosta self-assigned this Dec 23, 2025
@dinocosta dinocosta merged commit feb3ce3 into main Jan 5, 2026
24 checks passed
@dinocosta dinocosta deleted the 42137-add-selection-soft-wrap branch January 5, 2026 10:33
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
…45594)

When adding selections above/below with `skip_soft_wrap: true`, use
buffer column positions instead of pixel positions. This ensures
selections are placed at the same column offset in the buffer rather
than at the same visual position, which was incorrect for soft-wrapped
lines.

For example, selecting "how" in a wrapped line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show how a wrapped
   line would look
````

Now correctly adds a selection at the same buffer column in the next
line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show [how] a wrapped
   line would look
````

Closes #42137

Release Notes:

- Improved `editor: add selection above` and `editor: add selection
below` to select at the same text column when skipping soft-wrapped
lines, instead of the same visual position
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…ed-industries#45594)

When adding selections above/below with `skip_soft_wrap: true`, use
buffer column positions instead of pixel positions. This ensures
selections are placed at the same column offset in the buffer rather
than at the same visual position, which was incorrect for soft-wrapped
lines.

For example, selecting "how" in a wrapped line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show how a wrapped
   line would look
````

Now correctly adds a selection at the same buffer column in the next
line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show [how] a wrapped
   line would look
````

Closes zed-industries#42137

Release Notes:

- Improved `editor: add selection above` and `editor: add selection
below` to select at the same text column when skipping soft-wrapped
lines, instead of the same visual position
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
…ed-industries#45594)

When adding selections above/below with `skip_soft_wrap: true`, use
buffer column positions instead of pixel positions. This ensures
selections are placed at the same column offset in the buffer rather
than at the same visual position, which was incorrect for soft-wrapped
lines.

For example, selecting "how" in a wrapped line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show how a wrapped
   line would look
````

Now correctly adds a selection at the same buffer column in the next
line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show [how] a wrapped
   line would look
````

Closes zed-industries#42137

Release Notes:

- Improved `editor: add selection above` and `editor: add selection
below` to select at the same text column when skipping soft-wrapped
lines, instead of the same visual position
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
…ed-industries#45594)

When adding selections above/below with `skip_soft_wrap: true`, use
buffer column positions instead of pixel positions. This ensures
selections are placed at the same column offset in the buffer rather
than at the same visual position, which was incorrect for soft-wrapped
lines.

For example, selecting "how" in a wrapped line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show how a wrapped
   line would look
````

Now correctly adds a selection at the same buffer column in the next
line:

````
1. Very long line to
   show [how] a wrapped
   line would look
2. Very long line to
   show [how] a wrapped
   line would look
````

Closes zed-industries#42137

Release Notes:

- Improved `editor: add selection above` and `editor: add selection
below` to select at the same text column when skipping soft-wrapped
lines, instead of the same visual position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AddSelectionAbove/AddSelectionBelow doesn't add selection at the same position on soft-wrapped lines

1 participant