Skip to content

Fix OCR user dictionary add-actions#10594

Closed
HellbringerOnline wants to merge 5 commits intoSubtitleEdit:mainfrom
HellbringerOnline:codex/ocr-user-dictionary-unicode-normalization
Closed

Fix OCR user dictionary add-actions#10594
HellbringerOnline wants to merge 5 commits intoSubtitleEdit:mainfrom
HellbringerOnline:codex/ocr-user-dictionary-unicode-normalization

Conversation

@HellbringerOnline
Copy link
Copy Markdown
Contributor

@HellbringerOnline HellbringerOnline commented Apr 13, 2026

Summary

  • use the displayed or confirmed OCR word when adding unknown words to the user dictionary
  • refresh the in-memory OCR dictionary immediately after popup add-actions so the current OCR run sees the new user word right away
  • keep the side-panel unknown word add-action UI-only and avoid mutating the current unknown word list there

Problem

Some OCR add-actions used the raw OCR token instead of the displayed or corrected word. In addition, popup flows did not refresh the current OCR dictionary state immediately after adding a user word, so the just-added word could still be treated as unknown until a later refresh.

Changes

  • add AddUserWord(string word) to the OCR fix engine and update the runtime dictionary state immediately
  • add DisplayWord and ResolveSubmittedWord(...) so add-actions consistently submit the visible or confirmed word
  • keep popup traversal cleanup where it belongs, but remove unknown-word list cleanup from the side-panel add-action
  • cover the behavior with OCR-focused tests

Validation

  • dotnet test tests/UI/UITests.csproj --filter "FullyQualifiedName~UnknownWordItemTests|FullyQualifiedName~OcrFixEngineUserDictionaryTests"
  • dotnet build src/UI/UI.csproj -c Debug --no-restore

@niksedk
Copy link
Copy Markdown
Member

niksedk commented Apr 14, 2026

Looks good :)

RemoveUnknownWordsFromCurrentState shouldn’t be called here, as the UI unknown word list actions are only related to the UI.

Also, it would be great to keep PRs focused on a single concern. Could you move the Unicode normalization changes into a separate PR?

@HellbringerOnline
Copy link
Copy Markdown
Contributor Author

Looks good :)

RemoveUnknownWordsFromCurrentState shouldn’t be called here, as the UI unknown word list actions are only related to the UI.

Also, it would be great to keep PRs focused on a single concern. Could you move the Unicode normalization changes into a separate PR?

Ok, I'll try.

@niksedk
Copy link
Copy Markdown
Member

niksedk commented Apr 14, 2026

Looks good :)
RemoveUnknownWordsFromCurrentState shouldn’t be called here, as the UI unknown word list actions are only related to the UI.
Also, it would be great to keep PRs focused on a single concern. Could you move the Unicode normalization changes into a separate PR?

Ok, I'll try.

thx :)

@HellbringerOnline HellbringerOnline changed the title nOCR user dictionary unicode normalization Fix OCR user dictionary add-actions Apr 14, 2026
…y-fixes-upstream

# Conflicts:
#	src/UI/Features/Ocr/FixEngine/OcrFixEngine.cs
#	src/UI/Features/Ocr/OcrViewModel.cs
@niksedk
Copy link
Copy Markdown
Member

niksedk commented Apr 20, 2026

I think this does too much - and the remove stuff is not wanted.

@niksedk niksedk closed this Apr 20, 2026
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