Commit 4162f60
committed
fix(diff): user-initiated accept/reject should clean up windows and buffers
The user commands :ClaudeCodeDiffAccept and :ClaudeCodeDiffDeny call
_resolve_diff_as_saved/_rejected, which only mark the diff status. Real
cleanup (close windows, force-delete buffers, remove from active_diffs)
is performed by _cleanup_diff_state, currently triggered exclusively by
the close_tab MCP tool.
But close_tab has schema = nil (it is intentionally internal-only, as
documented in the source), so the Claude CLI never invokes it. The result
is that user-initiated accept/reject leaves the diff windows and buffers
behind, requiring manual cleanup.
The fix: have the user commands call _cleanup_diff_state themselves,
since they are not waiting for an MCP response from the CLI. Also
restore terminal focus when diff_opts.keep_terminal_focus is set
(previously this only applied at diff-open time).
Adds unit tests covering both commands and the no-marker no-op case.
Closes #205, partially addresses #238.1 parent 432121f commit 4162f60
2 files changed
Lines changed: 140 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1442 | 1442 | | |
1443 | 1443 | | |
1444 | 1444 | | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
1445 | 1457 | | |
1446 | | - | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
1447 | 1461 | | |
1448 | 1462 | | |
1449 | 1463 | | |
| |||
1454 | 1468 | | |
1455 | 1469 | | |
1456 | 1470 | | |
| 1471 | + | |
| 1472 | + | |
1457 | 1473 | | |
1458 | 1474 | | |
1459 | 1475 | | |
1460 | | - | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
1461 | 1479 | | |
1462 | 1480 | | |
1463 | 1481 | | |
| |||
1467 | 1485 | | |
1468 | 1486 | | |
1469 | 1487 | | |
1470 | | - | |
1471 | 1488 | | |
| 1489 | + | |
| 1490 | + | |
1472 | 1491 | | |
1473 | 1492 | | |
1474 | 1493 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
0 commit comments