Skip to content

Merge conflict UX: make u undo result-buffer edits from any conflict pane - #555

Closed
esmuellert with Copilot wants to merge 2 commits into
mainfrom
copilot/feat-undo-modification-result-buffer
Closed

Merge conflict UX: make u undo result-buffer edits from any conflict pane#555
esmuellert with Copilot wants to merge 2 commits into
mainfrom
copilot/feat-undo-modification-result-buffer

Conversation

Copilot AI commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

In merge mode, accept/discard actions update the result buffer, but undo previously required focus-switching into the result pane. This change makes u in non-result conflict panes undo the result buffer directly, enabling conflict-by-conflict workflows without navigation churn.

  • Conflict keymap behavior

    • Adds a conflict-scoped, buffer-local u mapping on left/right merge panes.
    • Executes undo in the result buffer context, preserving result-pane undo semantics while removing pane-switch overhead.
  • Regression coverage

    • Extends merge keymap ownership specs with a focused case that:
      • applies a conflict action from a non-result pane,
      • triggers u from that pane,
      • asserts result content returns to the pre-action state.
lifecycle.set_buf_keymap(tabpage, bufnr, "n", "u", function()
  if not session.result_bufnr or not vim.api.nvim_buf_is_valid(session.result_bufnr) then
    return
  end
  vim.api.nvim_buf_call(session.result_bufnr, function()
    vim.cmd("undo")
  end)
end, vim.tbl_extend("force", base_opts, { desc = "Undo previous result edit" }))

Co-authored-by: esmuellert <41042490+esmuellert@users.noreply.github.com>
Copilot AI changed the title [WIP] Add functionality to undo modification in result buffer with 'u' Merge conflict UX: make u undo result-buffer edits from any conflict pane Sep 7, 2026
Copilot AI requested a review from esmuellert September 7, 2026 19:52
@esmuellert esmuellert closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feat: pressing "u" undoes modification to result buffer regardless of active buffer location

2 participants