Skip to content

Explore Program.cs improvements for UI project#17

Merged
ivandrofly merged 93 commits intomainfrom
claude/adoring-aryabhata
Apr 10, 2026
Merged

Explore Program.cs improvements for UI project#17
ivandrofly merged 93 commits intomainfrom
claude/adoring-aryabhata

Conversation

@ivandrofly
Copy link
Copy Markdown
Owner

No description provided.

ivandrofly and others added 30 commits April 2, 2026 14:21
The _edited list was never populated, making the branch that checked
it dead code. Removed the field, its initialization, and the unreachable
branch in GeneratePreview.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…unnecessary variable and inline initialization
- Rename MakeVerticalSeperator to MakeHorizontalSeparator (was creating a horizontal line via Height)
- Rename MakeHorizontalSeperator to MakeVerticalSeparator (was creating a vertical line via Width)
- Fix typo backgroud -> background in both method parameters
- Update all call sites accordingly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ine save logic

- Added `Save` method for binary persistence.
- Refactored `Save` logic to use a shared `WriteToStream` method.
- Removed obsolete Ayato-specific handling in `BatchConverter`.
…rator-naming

Fix incorrect naming and typos in UiUtil separator methods
HellbringerOnline and others added 29 commits April 7, 2026 23:57
…spect-image-matches-full-preview

Fix full preview in Inspect image matches
Also try to optimize build a tiny bit
…ewModel

Unsubscribe from Settings.PropertyChanged in Dispose() to prevent the
handler from keeping the VM alive after the window is closed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Store handler reference and unsubscribe on window Closed to prevent
the VM from keeping window UI elements alive after closing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nged-subscription-leaks

Fix PropertyChanged subscription leaks in OcrWindow and BeautifyTimeCodesViewModel
…dited-field

Remove unused _edited field from RemoveTextForHearingImpairedViewModel
Previously, Avalonia's logical Key enum could not distinguish between
numpad keys (with NumLock off) and their non-numpad counterparts. For
example, pressing NumPad7 with NumLock off would produce Key.Home —
identical to the regular Home key — making it impossible to bind
different shortcuts to the two keys.

Root cause:
Avalonia's Key enum represents *logical* keys. When NumLock is off,
numpad 7 fires Key.Home, numpad 1 fires Key.End, numpad 0 fires
Key.Insert, NumPadDecimal fires Key.Delete, etc. The logical key alone
carries no information about whether the key originated from the numpad.

Fix:
Use KeyEventArgs.PhysicalKey, which reflects the actual hardware key
regardless of NumLock state. All numpad physical keys in Avalonia are
named with the "NumPad" prefix (NumPad0–NumPad9, NumPadDecimal, etc.),
while their logical counterparts are not (Home, End, Insert, Delete,
etc.). The new GetEffectiveKeyName() helper returns the PhysicalKey name
when the physical key is a numpad key, and the logical Key name
otherwise.

Concretely:
  - Regular Home:          PhysicalKey.Home    → "Home"
  - NumPad7 (NumLock ON):  PhysicalKey.NumPad7 → "NumPad7"
  - NumPad7 (NumLock OFF): PhysicalKey.NumPad7 → "NumPad7"  ← was "Home"

Changes:
- ShortcutManager: added GetEffectiveKeyName(Key, PhysicalKey) static
  helper and a parallel _activeEffectiveNames: HashSet<string> that
  tracks pressed keys using the physical override for numpad. The
  existing _activeKeys: HashSet<Key> is preserved unchanged so callers
  that rely on the logical Key enum (e.g. AllowedSingleKeyShortcuts
  filtering, GetActiveKeys().Count checks) continue to work. The
  shortcut hash lookup in CheckShortcuts now iterates
  _activeEffectiveNames instead of _activeKeys.

- GetKeyViewModel: when the user presses a key to record a shortcut
  binding, the stored key name is now derived via GetEffectiveKeyName()
  so that numpad 7 (either NumLock state) is recorded as "NumPad7"
  rather than "Home", matching what CheckShortcuts will see at runtime.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace six separate `b.Instance != null` checks with a single early-return
guard clause using pattern matching, reducing noise and improving readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ivandrofly ivandrofly merged commit 9949015 into main Apr 10, 2026
1 of 2 checks passed
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.

7 participants