Skip to content

Fix and improve OCR spell check prompt button behavior#11390

Merged
niksedk merged 3 commits into
SubtitleEdit:mainfrom
mjuhasz:feature/ocr-spell-check-button-handling
Jun 4, 2026
Merged

Fix and improve OCR spell check prompt button behavior#11390
niksedk merged 3 commits into
SubtitleEdit:mainfrom
mjuhasz:feature/ocr-spell-check-button-handling

Conversation

@mjuhasz
Copy link
Copy Markdown
Contributor

@mjuhasz mjuhasz commented Jun 4, 2026

Summary

Several correctness and usability improvements to the OCR spell check prompt (the dialog shown during OCR when an unknown word is encountered).

Button enable/disable logic

  • Change and Change all are disabled when the word textbox still shows the original flagged word — there is nothing to change yet. They enable once the user edits the text and re-disable if the edit is reverted.
  • Change and Change all are disabled when the word textbox is empty.
  • Google it, Add to names list, and Add to user dictionary are also disabled when the word textbox is empty.
  • Skip once and Skip all remain enabled at all times.

Edit whole text mode

  • The toggle button label switches between "Edit whole text" and "Edit word only" to reflect the current state.
  • Change once is disabled until the whole-text textbox differs from the original; re-disables if reverted.
  • Change all, Google it, Skip all, Add to names list, and Add to user dictionary are hidden (not just disabled) in this mode to reduce clutter. Only Change once and Skip once remain visible.
  • Grid rows are Auto-sized so hidden rows collapse cleanly.

Bug fixes

  • Skip all was passing the current textbox content to the engine instead of the original flagged word. If the user had edited or cleared the textbox, the wrong word (or an empty string) would be skipped. Fixed to always use the original flagged word.
  • SuggestionUseAlways() was missing the null/empty guard that SuggestionUse() already had; if triggered with no suggestion selected it would submit an empty Change all.

Google it

  • The button was a no-op stub. Now opens a Google search for the word in the default browser using Avalonia's Launcher API.
Spell.check.mov

Miklos Juhasz added 3 commits June 4, 2026 15:25
…extbox content

Skip all is meant to tell the engine to never flag this word as unknown
again. It was passing result.Word — the current textbox content — which
could be empty or edited by the user. The original flagged word is
available as unknownWord.Word.FixedWord in scope at all three call sites
and is the correct value to pass regardless of textbox state.
The button was a no-op stub. Opens a Google search for the word in the
default browser using Avalonia's Launcher API, matching the existing
implementation in SpellCheckViewModel.
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

This PR improves the OCR “unknown word” prompt dialog by making button states reflect whether an action is valid, reducing UI clutter in whole-text edit mode, and fixing a correctness issue where “Skip all” could skip the wrong word.

Changes:

  • Implement command-level CanExecute logic for Change/Change all (and other actions) based on whether the word/whole text differs from the original and is non-empty.
  • Update the prompt window UI to hide irrelevant buttons in “edit whole text” mode and auto-size rows so hidden rows collapse cleanly; toggle label now reflects current mode.
  • Fix OCR engine integration so “Skip all” always skips the original flagged word (not the edited textbox content); implement Google search via Avalonia Launcher.

Reviewed changes

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

File Description
src/ui/Features/Ocr/PromptUnknownWordWindow.cs Updates UI bindings: toggle label binding, hides buttons in whole-text mode, and uses auto rows so layout collapses cleanly.
src/ui/Features/Ocr/PromptUnknownWordViewModel.cs Adds original-value tracking + CanExecute gating for commands; fixes SuggestionUseAlways empty-guard; implements Google search launch.
src/ui/Features/Ocr/OcrViewModel.cs Fixes “Skip all” to use the original unknown word value when calling the OCR fix engine.

@niksedk niksedk merged commit 315c48c into SubtitleEdit:main Jun 4, 2026
2 checks passed
@mjuhasz mjuhasz deleted the feature/ocr-spell-check-button-handling branch June 4, 2026 19:52
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.

3 participants