Commit 01be2e1
DiffViewer: show only changed lines in revert-hunk preview
The "Revert hunk?" confirmation dialog built its 3-line preview by
taking the first 3 lines of the hunk - which, because DiffService
prepends 3 lines of unchanged context to every hunk, almost always
meant the user saw three lines that weren't even being reverted, and
nothing about the actual change.
Filter the preview to inserted/deleted/modified lines only and prefix
each with the standard diff marker (+/-/~) so the user can see what
will actually be discarded. The overflow indicator (...) now counts
overflow among changed lines rather than total lines, matching what
the user is now reading.
Adds a regression test asserting the preview contains the changed
lines with markers and not the leading context line.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 7fc48c7 commit 01be2e1
2 files changed
Lines changed: 60 additions & 3 deletions
File tree
- DiffViewer.Tests/ViewModels
- DiffViewer/ViewModels
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
339 | 375 | | |
340 | 376 | | |
341 | 377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
217 | 238 | | |
218 | 239 | | |
219 | 240 | | |
220 | | - | |
221 | | - | |
| 241 | + | |
| 242 | + | |
222 | 243 | | |
223 | 244 | | |
224 | 245 | | |
| |||
0 commit comments