Skip to content

feat(terminal): view diff on unsaved file close#1242

Open
shamounY wants to merge 1 commit intostablyai:mainfrom
shamounY:shamounY/feat-diff-on-unsaved-file
Open

feat(terminal): view diff on unsaved file close#1242
shamounY wants to merge 1 commit intostablyai:mainfrom
shamounY:shamounY/feat-diff-on-unsaved-file

Conversation

@shamounY
Copy link
Copy Markdown
Contributor

@shamounY shamounY commented Apr 29, 2026

Summary

This PR introduces a brand-new "View Diff" feature for the unsaved changes prompt when closing a file. Previously, if users had unsaved changes and tried to close a file, they had to either blindly save, discard, or manually cancel to go look at their code again.

Screenshots

image image

With this feature:

  1. View Diff Button: Adds a new action to the unsaved close prompt.
  2. Inline Diff Viewer Modal: When clicked, a full diff viewer opens comparing the current dirty draft against the canonical file on disk, utilizing the Monaco DiffEditor component.
  3. Integrated Actions: The diff view modal itself includes full Back, Don't Save, and Save footer buttons, meaning users can confidently evaluate their changes and save directly from within the diff workflow.
  4. Queue Management (unsaved-close-queue.ts): We now properly track and dequeue files during bulk closes (like quitting the window or closing all tabs) so you get sequentially prompted for each unsaved file exactly once, avoiding duplicate dialog overlaps.

Closes #1237

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build

@AmethystLiang
Copy link
Copy Markdown
Contributor

thx for the PR! @brennanb2025 will review it tmr

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.

[Bug]: Closing modified file does not trigger save confirmation

3 participants