Skip to content

Restore Fix Continuation Style settings#11503

Closed
mjuhasz wants to merge 7 commits into
SubtitleEdit:mainfrom
mjuhasz:fix/continuation-style-setting
Closed

Restore Fix Continuation Style settings#11503
mjuhasz wants to merge 7 commits into
SubtitleEdit:mainfrom
mjuhasz:fix/continuation-style-setting

Conversation

@mjuhasz

@mjuhasz mjuhasz commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Continuation style related functionality is now fully present in SE5, used in the Fix Common Errors rule, and I also fixed some related bugs. The PR looks large because I salvaged most of the localization and it contains tests as well.

Changes

New: Fix Continuation Style Settings dialog
A dedicated settings sub-dialog accessible from Settings → Rules, containing:

  • Heuristic filter flags: uncheck inserts in all-caps / italic / lowercase, hide candidates without a name, ignore lyrics
  • Continuation pause threshold (ms)
  • Shortcut to edit the custom continuation style

Sync continuation settings into libse on startup
SetLibSeSettings now copies all continuation fields (ContinuationPause, 13 CustomContinuationStyle* fields, 5 FixContinuationStyle* flags) into Configuration.Settings.General so libse consumers (ContinuationUtilities, FixContinuationStyle) use the correct values at runtime.

Bug fixes

  • Fixed invalid character (\uFFFD) in custom continuation style dropdown items
  • Fixed "Edit custom style" button not appearing when the settings page was reopened
  • Fixed continuation settings not being reset when choosing Reset Rules
  • Fixed ColorDurationTooLong not being reset when choosing Reset Syntax Coloring (self-assignment no-op)

Localization
Added fixContinuationStyleSettings, customContinuationStyleNote, and six supporting strings to all 25 language files. Hungarian and Portuguese have full translations.

Settings - Tools Settings for fixing continuation style Edit custom continuation style

Miklos Juhasz added 7 commits June 8, 2026 20:30
The edit button next to the continuation style dropdown was only made
visible via ContinuationStyleChanged(), which fires on user interaction
but not on initial load. Initialize the visibility from the saved setting
when the settings page loads.
Replace raw Windows-1252 byte 0x85 with proper UTF-8 encoding of the
horizontal ellipsis character (U+2026) in the prefix/suffix options list.
Wire the Avalonia general settings bridge so continuation-specific values stored in Se.Settings.General are copied into Configuration.Settings.General before libse consumers run.

This extends the existing SetLibSeSettings path to include ContinuationPause, the full CustomContinuationStyle profile, and the FixContinuationStyle heuristic booleans in addition to the already-synced continuation enum.

Add focused UITests coverage for the bridge by exposing an internal helper that maps SeGeneral into libse GeneralSettings. The tests verify both direct field copying and the downstream libse behavior through ContinuationUtilities.GetContinuationProfile(ContinuationStyle.Custom) and GetMinimumGapMs().

This restores the missing runtime wiring so edits made in the custom continuation style dialog take effect in Fix Common Errors and other libse continuation logic after Apply/OK.
Bring back the dedicated continuation-style settings entry under the Tools section so v5 matches the 4.0.15-custom workflow. The settings page now exposes an Edit action for Fix Common Errors continuation handling, and that action opens a new FixContinuationStyleSettings dialog.

The new dialog restores the five continuation heuristics, the pause threshold, and the existing custom continuation style editor entry point. SettingsViewModel now loads and saves the FixContinuationStyle* flags from Se.Settings.General, returns accepted dialog values back into the main settings screen, and keeps ContinuationPause plus the custom continuation profile synchronized when the nested custom-style editor is used.

Register the new dialog view model in dependency injection and add the missing option-language keys to LanguageSettings plus all bundled language JSON files so the restored controls have labels in shipped translations.

Add focused UITests coverage for the new dialog view model initialization and the nested custom continuation editor handoff. Verified with dotnet test tests/UI/UITests.csproj and the full UITests suite passes after the language asset updates.
Restore the new continuation-related global settings when users reset rules in Settings. The reset path now reapplies SeGeneral defaults for the continuation pause threshold, custom continuation style parameters, and the continuation-fix heuristics instead of leaving those values behind.

Keep the current scope model intact by leaving continuation heuristics and custom continuation values global, but add an explicit note in the custom continuation style dialog that those values are shared across profiles.

Repair the user-visible localization regressions for the continuation settings strings across the language files touched by the branch, including the new shared-profile note and the previously untranslated fix-continuation labels.

Add UI regression tests covering the reset-rules behavior and the restored Hungarian and Portuguese translations for the continuation settings.
- Fix ColorDurationTooLong self-assignment no-op in ApplyResetSelections;
  it was never being reset to its default on Reset Syntax Coloring
- Fix test isolation: restore 4 FixContinuationStyle singleton flags in
  finally block of ContinuationSettingsSyncTests (defaults are true,
  test wrote false and left them corrupted)
- Add shared-profiles note to FixContinuationStyleSettingsWindow below
  the Edit Custom Style button, matching CustomContinuationStyleWindow
@niksedk

niksedk commented Jun 9, 2026

Copy link
Copy Markdown
Member

thx for the PR :)

I think we should wait with the UI stuff for now, and keep with the SE 4 style.

The bugs + per profile handling included in this PR: #11510

@niksedk niksedk closed this Jun 9, 2026
@mjuhasz

mjuhasz commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

A fix was missed; it's a trivial change. I opened a PR for that: #11513

@mjuhasz

mjuhasz commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@niksedk One more thing: ContinuationPause (the gap threshold used to decide whether to apply the "long pause" variant of a style) is consumed by all "None/mixed" continuation styles via ContinuationUtilities.GetMinimumGapMs(), not just Custom.

In your PR, it is only exposed in the UI through the Custom style editor, so users who never select Custom will always get the hardcoded default of 300 ms and have no way to change it. This may be an acceptable design choice.

However, it also means the value persists across style switches: if a user sets it to e.g. 2000 ms while on Custom, then switches to "None, ellipsis for pauses", the 2000 ms threshold silently carries over and suppresses most ellipsis insertions. That's unexpected: the same (non-Custom) continuation style behaves differently based on past configuration of another (the Custom) style.

I am not exactly sure how you want to design the rest of the continuation style UI/behavior so I'm going to stop here with my changes for the time being and let you decide: make non-Custom profiles always use the default 300ms (fairly easy), expose the setting globally or per continuation style, or leave things as is for the time being. I'm happy to help with the change if we align on the direction. If I see it correctly I can replicate any of the "None/mixed" styles in Custom so the choice of defaulting to 300ms sounds reasonable, and if one wants a different value, go to Custom and set one there.

@mjuhasz mjuhasz deleted the fix/continuation-style-setting branch June 9, 2026 15:46
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