Skip to content

Add SE 4 "Move cue one frame (keep gap if close)" shortcuts (#11245)#11247

Merged
niksedk merged 1 commit into
mainfrom
feat/move-cue-one-frame-keep-gap
May 29, 2026
Merged

Add SE 4 "Move cue one frame (keep gap if close)" shortcuts (#11245)#11247
niksedk merged 1 commit into
mainfrom
feat/move-cue-one-frame-keep-gap

Conversation

@niksedk
Copy link
Copy Markdown
Member

@niksedk niksedk commented May 29, 2026

Summary

Ports the four SE 4 shortcuts requested in #11245:

  • MainAdjustMoveStartOneFrameBackKeepGapPrev
  • MainAdjustMoveStartOneFrameForwardKeepGapPrev
  • MainAdjustMoveEndOneFrameBackKeepGapNext
  • MainAdjustMoveEndOneFrameForwardKeepGapNext

Behavior (matches SE 4 Forms/Main.cs MoveStartCurrent ~20984 / MoveEndCurrent ~21097): when the gap to the previous (or next) subtitle is MinimumBetweenLines (i.e. inclusive of equality — same condition SE 4 uses), dragging the cue also drags the neighbor's edge by the same delta, preserving the existing gap. Min-duration guard on the neighbor aborts the move rather than producing a sub-minimum line. Outside the "close" window the behavior is identical to the existing plain "Move start/end one frame" variants.

The existing plain shortcuts are unchanged.

Touchpoints

  • MainViewModel.cs (~8590) — 4 new [RelayCommand] methods; MoveStartByFrames / MoveEndByFrames gain a keepGap flag.
  • LanguageSettingsShortcuts.cs — 4 new label strings.
  • ShortcutsMain.cs — labels dictionary + AddShortcut registrations.
  • Se4ShortcutsImporter.csMainAdjustMove*KeepGap* → SE 5 command mappings so importing an SE 4 Settings.xml carries the keybindings across.

Test plan

  • Options → Shortcuts → search "keep gap" → four entries appear; bind each to a key (e.g. Alt+Shift+Left/Right style).
  • Two adjacent subtitles with gap ≤ MinimumBetweenLines:
    • Press MoveStartOneFrameBackKeepGapPrev → both this start AND prev end move back by one frame; gap unchanged.
    • Press MoveStartOneFrameForwardKeepGapPrev → both shift forward by one frame; gap unchanged.
    • MoveEndOneFrameForwardKeepGapNext / MoveEndOneFrameBackKeepGapNext — symmetric checks on the end side.
  • Gap strictly greater than MinimumBetweenLines: KeepGap variant behaves like the plain variant (no neighbor drag).
  • Gap exactly MinimumBetweenLines: KeepGap engages (matches SE 4's <= / >= boundary).
  • Neighbor at minimum duration: pressing the KeepGap key that would shrink it further is a no-op (doesn't violate min duration).
  • Import an SE 4 Settings.xml that has the four MainAdjustMove*KeepGap* bindings → they map onto the new SE 5 commands.

Refs #11245.

🤖 Generated with Claude Code

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports four Subtitle Edit 4 “move cue one frame (keep gap if close)” shortcuts into SE 5 by adding new commands and wiring them into the shortcuts UI, localization labels, and the SE4 Settings.xml shortcut importer.

Changes:

  • Added four new [RelayCommand] commands in MainViewModel and extended the existing one-frame move helpers with keepGap*IfClose behavior.
  • Registered the new commands in the shortcuts list/translation map and added English label strings.
  • Mapped SE4 shortcut IDs to the new SE5 commands in the SE4 shortcuts importer.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/ui/Logic/ShortcutsMain.cs Adds command translation entries and registers the 4 new shortcuts in the available shortcuts list.
src/ui/Logic/Config/Language/Options/LanguageSettingsShortcuts.cs Adds 4 new shortcut label properties and default English strings.
src/ui/Features/Options/Shortcuts/Se4ShortcutsImporter.cs Maps SE4 “KeepGap” shortcut IDs to the new SE5 commands for import compatibility.
src/ui/Features/Main/MainViewModel.cs Implements the 4 new commands, adds keepGap flags to move helpers, and also changes undocked-window Topmost behavior.

Comment on lines +5256 to +5260
// Float above main while main (or this window) is active, but drop behind when
// SE loses focus to another app. Mirrors the Find/Replace helper from #11243.
// The two undocked windows are still independent in Alt+Tab — KeepTopmost… is
// just a Z-order knob, not an ownership change.
WindowService.KeepTopmostWhileOwnerActive(window, Window!);
Comment on lines +8646 to +8649
if (keepGapPrevIfClose && prev != null
&& prev.EndTime.TotalMilliseconds <= s.StartTime.TotalMilliseconds
&& prev.EndTime.TotalMilliseconds + gapMs >= s.StartTime.TotalMilliseconds)
{
Comment on lines +8697 to +8700
if (keepGapNextIfClose && next != null
&& s.EndTime.TotalMilliseconds <= next.StartTime.TotalMilliseconds
&& s.EndTime.TotalMilliseconds + gapMs >= next.StartTime.TotalMilliseconds)
{
Ports the four SE 4 shortcuts from issue #11245:
- MainAdjustMoveStartOneFrameBackKeepGapPrev
- MainAdjustMoveStartOneFrameForwardKeepGapPrev
- MainAdjustMoveEndOneFrameBackKeepGapNext
- MainAdjustMoveEndOneFrameForwardKeepGapNext

Behavior matches SE 4's MoveStartCurrent / MoveEndCurrent (Forms/Main.cs
~20984 / ~21097): when the gap to the previous (or next) subtitle is
already tighter than MinimumBetweenLines, drag the neighbor's edge by the
same delta so the existing small gap is preserved instead of collapsing
or being clamped at the standard gap. Min-duration guard on the neighbor
aborts the move rather than producing a sub-minimum line.

The existing plain "Move start/end one frame" variants are unchanged.

Wires through:
- 4 new RelayCommand methods in MainViewModel
- Shared MoveStart/EndByFrames helpers gain a keepGap flag
- Language strings (LanguageSettingsShortcuts)
- Shortcut dictionary + AddShortcut registrations (ShortcutsMain)
- SE 4 importer mappings (Se4ShortcutsImporter) so users importing an SE 4
  settings.xml get the new bindings

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@niksedk niksedk force-pushed the feat/move-cue-one-frame-keep-gap branch from 28d7e14 to ee6d34f Compare May 29, 2026 09:04
@niksedk niksedk merged commit 94467ff into main May 29, 2026
1 of 3 checks passed
@niksedk niksedk deleted the feat/move-cue-one-frame-keep-gap branch May 29, 2026 09:10
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.

2 participants