Skip to content

AddSelectionAbove/AddSelectionBelow forgets the original cursor offset when moving to a shorter line #46842

@injust

Description

@injust

Reproduction steps

  1. Use this snippet:
foo bar baz
foo
foo bar
  1. Put the cursor at the end of line 1
  2. editor::AddSelectionBelow twice

Current vs. Expected behavior

There should be a cursor at the end of each line.

Instead, once a cursor is added on the shorter line 2, the original cursor offset is forgotten, so you get this:

Image

I think this originally worked in #40190, but I suspect it broke in #45594.

cc @dinocosta

Zed version and system specs

Zed: v0.219.4+stable.119.5595f7ce23d51a58eb66dd025a487bbd6c75dad1 (Zed)
OS: macOS 15.7.3
Memory: 16 GiB
Architecture: x86_64

Metadata

Metadata

Assignees

Labels

community championIssues filed by our amazing community champions! 🫶frequency:commonBugs that happen for at least a third of the users across all platforms and kinds of usagepriority:P2Average run-of-the-mill bugsstate:reproducibleVerified steps to reproduce included and someone on the team managed to reproduce

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions