sindrets / diffview.nvim

Single tabpage interface for easily cycling through diffs for all modified files for any git rev.
Other
3.85k stars 105 forks source link

Staging a hunk requires a new DiffView to be opened to refresh #280

Closed steliyan closed 1 year ago

steliyan commented 1 year ago

I use gitsigns to stage hunks, however the staged changes are not properly shown in DiffView.

How to reproduce:

  1. Open a file and add 2 new lines
  2. Go to the first line
  3. Press V (<S-v>) for V-LINE mode
  4. Stage the hunk (the selected line) using :Gitsigns stage_hunk

Expected: Diff in Changes shows only the second line/Diff in Staged shows only the first line Actual: Diff in Changes shows the first and second lines/Diff in Staged does not show any diff (check the attached video)

Reopening using :DiffViewOpen fixes the issue, however, this is pretty bad from DX as this breaks my workflow when making and staging changes through DiffView.

https://user-images.githubusercontent.com/1850292/210347148-562898cf-a44c-4d7a-9ddb-d6af341e8aac.mov

sindrets commented 1 year ago

Thanks for the report! Should be fixed in the latest commit.

steliyan commented 1 year ago

@sindrets, thanks for the quick reaction! The fix works as expected.

This was a big pet peeve of mine, because I heavily use partial staging and I had to resort back to VS Code to double check what was actually staged.

Keep up the good work! :)