Treat save-changes dialog dismissal as Cancel instead of No#11985
Merged
niksedk merged 2 commits intoJun 29, 2026
Conversation
Treat anything that is not Yes or No (Cancel, the None returned when the dialog is dismissed via the title bar, or any future result) as cancel, so unsaved changes are never silently discarded. Equivalent to the previous 'Cancel || None' check but robust to other non-answers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pull Bot
pushed a commit
to matrixer2306/subtitleedit
that referenced
this pull request
Jun 29, 2026
The five 'Save changes?' Yes/No/Cancel prompts in MainViewModel each repeated the same show-dialog-and-decide block. Extract a PromptSaveChanges helper (plus SaveCurrentSubtitle / SaveCurrentSubtitleOriginal) so the dialog and the cancel/dismiss handling live in one place. Behavior is unchanged: Yes saves and proceeds only if the save succeeds, No discards and proceeds, Cancel or a title-bar dismissal (MessageBoxResult.None) aborts. Net -36 lines. Follow-up to SubtitleEdit#11985. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a "Save changes?" dialog is closed without clicking any button, the result was incorrectly treated as
No, causing unsaved changes to be silently discarded. SE4 handled this correctly by treating it as a cancellation.Cause & Fix
MessageBox.ShowreturnsMessageBoxResult.Nonewhen no button is clicked. The affected code paths only checked forMessageBoxResult.Cancel, soNonefell through to the "No" branch.The fix adds
|| dr == MessageBoxResult.Noneto all five save-changes guard conditions inMainViewModel.cs:FileCloseTranslationHasChangesContinueContinueNewOrExitOriginalOnClosingOnWindowClosingTesting
Tested on Windows 11 x64 (local build).