Skip to content

Fix three bugs: timecode whitespace regression, culture parsing, F10 shortcut override#12545

Merged
niksedk merged 1 commit into
mainfrom
fix/three-bugs
Jul 16, 2026
Merged

Fix three bugs: timecode whitespace regression, culture parsing, F10 shortcut override#12545
niksedk merged 1 commit into
mainfrom
fix/three-bugs

Conversation

@niksedk

@niksedk niksedk commented Jul 16, 2026

Copy link
Copy Markdown
Member

Three verified bugs found by an adversarial hunt (each reproduced before/after).

1. TimeCode.ParseToMilliseconds — whitespace-only fraction regression

Introduced by this morning's round-2 span rewrite. A whitespace-only sub-second field returned 0 instead of the legacy value:

ParseToMilliseconds("0:0:1: ")  // before fix: 0    after fix: 1000

The old parts[3].PadRight(3,'0') turned " " into " 00", which int.Parse reads as 0 (leading whitespace tolerated), so the seconds still counted. The rewrite's hand-rolled "trailing whitespace fails" shortcut rejected it outright. Fixed by padding into a stack buffer — exact PadRight semantics, so " " → 0 but "5 " still fails (embedded whitespace). Reachable from malformed time codes in niche importers; low severity but a real behavior change vs. the "byte-identical" commit claim.

2. Culture-unsafe numeric parsing in 38 format files

double.Parse / float.Parse / Convert.ToDouble without InvariantCulture. On a comma-decimal locale (German, French, …) a decimal value like a "1.5" Final Cut Pro duration parses as 15 — corrupting imported timings. Swept CultureInfo.InvariantCulture into every single-argument numeric parse across SubtitleFormats/. Integer-valued fields (most FCP timebase/rational tokens, MPlayer2 deciseconds) are unchanged; the genuinely decimal ones are fixed. Verified a de-DE JacoSub load parses correctly.

The top-tier formats (SubRip, ASSA, WebVTT, TimedText10, EBU STL, PAC, MicroDVD, SAMI) were already invariant — this hardens the long tail.

3. F10 menu-focus shortcut can't be overridden — #12504

F10 (added in #11745 to activate the menu bar for keyboard/screen-reader access) unconditionally swallowed the key, so a user-assigned F10 action never fired. Added IShortcutManager.HasSingleKeyShortcut(keyName); the built-in menu toggle now yields when the user has bound F10 to something. The menu bar stays reachable via Alt. Same guard in the main window and the binary-edit (image-sub) window.

Verified

  • Before/after repro for each.
  • New TimeCodeParseTest (7 cases incl. the whitespace-fraction regression and the digit+space fail case).
  • All 492 libse + 233 seconv tests pass; full solution builds.

🤖 Generated with Claude Code

1. TimeCode.ParseToMilliseconds: a whitespace-only sub-second field (e.g.
   "0:0:1: ") returned 0 instead of 1000 after the round-2 span rewrite.
   The legacy PadRight(3,'0') turned " " into " 00" (leading whitespace,
   which int.Parse tolerates -> 0), but the hand-rolled "trailing
   whitespace fails" shortcut rejected it outright. Restore exact PadRight
   semantics by padding into a stack buffer. Reachable from malformed time
   codes in niche importers.

2. Culture-unsafe float/double parsing in 38 subtitle-format files: bare
   double.Parse/float.Parse/Convert.ToDouble without InvariantCulture would
   misread decimal values (e.g. a "1.5" frame/timebase as 15) on a
   comma-decimal locale like German, corrupting imported timings. Add
   CultureInfo.InvariantCulture to every single-argument numeric parse in
   SubtitleFormats. Integer-valued fields are unaffected; the genuinely
   decimal ones (Final Cut Pro durations, JacoSub) are fixed.

3. F10 menu-focus shortcut couldn't be overridden (#12504): F10 always
   activated the menu bar, ignoring a user-assigned F10 action. Add
   IShortcutManager.HasSingleKeyShortcut and skip the built-in menu toggle
   when the user has bound F10; the menu stays reachable via Alt. Same
   guard in the main window and the binary-edit window.

Verified: repro before/after for all three; new TimeCode parse tests
(incl. the whitespace-fraction regression and the digit+space fail case)
and a de-DE JacoSub load; all 492 libse + 233 seconv tests pass; full
solution builds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@niksedk
niksedk merged commit add78c1 into main Jul 16, 2026
1 of 3 checks passed
@niksedk
niksedk deleted the fix/three-bugs branch July 16, 2026 14:06
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.

1 participant