Commit 7def832
DiffViewer: replace revert-hunk preview with a one-line summary
The preview block was rendering as plain unstyled text in a generic white WPF dialog (Segoe UI, no syntax colors), so even after filtering to changed lines with +/- markers, the result looked like it came from a different app than DiffViewer. Plumbing the editor color scheme, font family, and font size into a confirmation dialog isn't worth the view-layer surface area when the user just needs to confirm intent.
Drop the line excerpt entirely and replace it with a one-line count summary the user can read at a glance:
Discard this hunk from the working tree? This cannot be undone via git.
1 addition, 1 removal at line 47 in MyMethod().
The reported line number is the first actually-changed line in the hunk (first non-context line's NewLineNumber, falling back to OldLineNumber for pure deletions). hunk.NewStartLine would have pointed at the leading context line DiffService prepends to every hunk, putting the reported position a line or two above where the change actually sits. Function context is the unified-diff '@@ ... @@' trailer, included only when DiffService captured one.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 01be2e1 commit 7def832
2 files changed
Lines changed: 49 additions & 34 deletions
File tree
- DiffViewer.Tests/ViewModels
- DiffViewer/ViewModels
Lines changed: 16 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
347 | 349 | | |
348 | 350 | | |
349 | 351 | | |
| |||
366 | 368 | | |
367 | 369 | | |
368 | 370 | | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
373 | 379 | | |
374 | 380 | | |
375 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | 216 | | |
239 | 217 | | |
240 | 218 | | |
241 | | - | |
242 | | - | |
| 219 | + | |
243 | 220 | | |
244 | 221 | | |
245 | 222 | | |
| |||
264 | 241 | | |
265 | 242 | | |
266 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
267 | 276 | | |
268 | 277 | | |
269 | 278 | | |
| |||
0 commit comments