Fix video offset with "Keep existing time codes" modifying the file (#11637)#11639
Merged
Conversation
…11637) The video offset is a non-destructive display offset (TimeSpanToDisplayFullConverter shows "time code + offset" while the stored time codes stay untouched). The "Keep existing time codes" handling was inverted: checking the box mutated the paragraphs (and only StartTime, corrupting durations), marked the file dirty, and double-applied the offset on reopen. Match the legacy semantics where the checkbox is the non-destructive path: - checked: leave the time codes alone, only set the display offset - unchecked: bake the offset delta into both StartTime and EndTime so the displayed values stay put while the underlying codes change (marks dirty) Use the offset delta (new - old) so re-running the dialog with an existing offset is correct. Also cast to long to match CurrentVideoOffsetInMs. 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.
Fixes #11637
Problem
Using Set video offset with Keep existing time codes modified the subtitle's time codes instead of leaving them alone:
01:00:00:00reopened at02:00:00:00when unsaved, or00:00:00:00when saved).Cause
In the new Avalonia UI the video offset is a non-destructive display offset —
TimeSpanToDisplayFullConverterrenderstime code + offsetwhile the stored time codes stay untouched. The handler inMainViewModel.ShowVideoSetOffsethad the logic inverted: checking Keep existing time codes was the branch that subtracted the offset from the paragraphs (and onlyStartTime, corrupting durations) and dirtied the file.This is backwards from the legacy
Main.cs, whereDoNotaddVideoOffsetToTimeCodes(the checked state) is the path that resets the change-hash so the file is not marked dirty.Fix
new − old) into bothStartTimeandEndTime, so the displayed values stay put while the underlying codes change (and the file is correctly marked as modified). Using the delta makes re-running the dialog with an existing offset correct.longto match thelong CurrentVideoOffsetInMsfield.🤖 Generated with Claude Code