zed icon indicating copy to clipboard operation
zed copied to clipboard

editor: Fix git-hunk toggling for adjacent hunks

Open seanstrom opened this issue 1 month ago • 2 comments

Closes #42934

Release Notes:

  • Fix toggling adjacent git-diff hunks based on the reported behaviour in #42934

seanstrom avatar Nov 20 '25 19:11 seanstrom

Commentary

  • The command for toggling selected git-diff hunks as some complex behaviours depending on the position of the cursor, and whether there are multiple git-hunks near each other (separated by a line, or without a line separation).
  • I've left some notes and recordings attached to issue #42934
  • And this PR creates a failing test for one of the cases with adjacent hunks, however, we may want to add more tests and define the intended behaviour of the hunk-toggling command to avoid more regressions.

seanstrom avatar Nov 20 '25 19:11 seanstrom

Here's a screen recording of the current behaviour with the changes in this PR:

https://github.com/user-attachments/assets/49abe418-cb21-4740-bd8a-a6798fbec50a

seanstrom avatar Nov 20 '25 19:11 seanstrom