Skip to content

bug(diff): unified layout skips diff lifecycle User events #296

Description

@ThomasK33

Summary

diff_opts.layout = "unified" appears to skip the ClaudeCodeDiffOpened and ClaudeCodeDiffClosed User autocmds that are documented for proposed-edit diffs.

Evidence

  • lua/claudecode/diff.lua dispatches layout == "unified" to claudecode.diff_inline.setup_inline_diff(...) before the native diff path reaches the common ClaudeCodeDiffOpened event emission.
  • lua/claudecode/diff_inline.lua opens the unified diff split, renders the scratch buffer, and registers diff state, but does not emit ClaudeCodeDiffOpened.
  • lua/claudecode/diff.lua also returns early from _cleanup_diff_state for diff_data.layout == "unified" after calling inline.cleanup_inline_diff(...), before the common ClaudeCodeDiffClosed event emission.
  • lua/claudecode/diff_inline.lua cleanup does not emit ClaudeCodeDiffClosed either.

Expected behavior

All diff layouts that open a proposed-edit review UI should fire the same lifecycle events, matching the README's Diff Lifecycle Events section:

  • ClaudeCodeDiffOpened when the unified diff opens
  • ClaudeCodeDiffClosed when the unified diff is accepted/rejected/cleaned up

Impact

User configs that rely on these events for terminal resizing, statusline updates, or other review-lifecycle behavior work for native vertical/horizontal diffs but not for the unified layout.

Validation performed

Found while triaging #294.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions