diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-19 15:58:30 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-19 16:08:02 +0300 |
| commit | 14357aee5c0db8665bea2da817d67f12d0499451 (patch) | |
| tree | e7cf4d3b45d7cb4a202490e5d5d83039889babb1 /internal/gui/navigation.go | |
| parent | d8c65cd0511b558fe62aac7022c267f51d76f3f9 (diff) | |
feat: improve GUI layout and add Cyrillic keyboard supportv0.5.0
- Move navigation buttons to top toolbar
- Increase window height (600→700px) and phonetic info area (100→180px)
- Fix file check ticker race condition
- Remove File menu, add export/help icons to toolbar
- Add comprehensive Cyrillic keyboard support for all hotkeys
- Support Cyrillic keys in all dialogs (help, export, delete confirmation)
- Add project page link to help dialog
- Bump version to 0.5.0
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'internal/gui/navigation.go')
| -rw-r--r-- | internal/gui/navigation.go | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/internal/gui/navigation.go b/internal/gui/navigation.go index e166283..8cba6c3 100644 --- a/internal/gui/navigation.go +++ b/internal/gui/navigation.go @@ -458,18 +458,30 @@ func (a *Application) loadExistingFiles(word string) { // startFileCheckTicker starts a ticker to check for missing files func (a *Application) startFileCheckTicker() { + // Stop any existing ticker first + if a.fileCheckTicker != nil { + a.fileCheckTicker.Stop() + } + // Create ticker that checks every 2 seconds - a.fileCheckTicker = time.NewTicker(2 * time.Second) + ticker := time.NewTicker(2 * time.Second) + a.fileCheckTicker = ticker go func() { - for range a.fileCheckTicker.C { - // Only check files for the current word - a.mu.Lock() - currentWord := a.currentWord - a.mu.Unlock() - - if currentWord != "" { - a.checkForMissingFiles(currentWord) + for { + select { + case <-ticker.C: + // Only check files for the current word + a.mu.Lock() + currentWord := a.currentWord + a.mu.Unlock() + + if currentWord != "" { + a.checkForMissingFiles(currentWord) + } + case <-a.ctx.Done(): + // Application is shutting down + return } } }() @@ -582,6 +594,31 @@ func (a *Application) onDelete() { // Create a custom key handler for the dialog window oldKeyHandler := a.window.Canvas().OnTypedKey() + oldRuneHandler := a.window.Canvas().OnTypedRune() + + // Handle both Latin and Cyrillic keys + a.window.Canvas().SetOnTypedRune(func(r rune) { + if a.deleteConfirming { + switch r { + case 'y', 'Y', 'ъ', 'Ъ': + confirmDialog.Hide() + a.deleteConfirming = false + a.deleteCurrentWord() + // Restore original handlers + a.window.Canvas().SetOnTypedKey(oldKeyHandler) + a.window.Canvas().SetOnTypedRune(oldRuneHandler) + case 'n', 'N', 'н', 'Н': + confirmDialog.Hide() + a.deleteConfirming = false + // Restore original handlers + a.window.Canvas().SetOnTypedKey(oldKeyHandler) + a.window.Canvas().SetOnTypedRune(oldRuneHandler) + } + } else if oldRuneHandler != nil { + oldRuneHandler(r) + } + }) + a.window.Canvas().SetOnTypedKey(func(ev *fyne.KeyEvent) { if a.deleteConfirming { switch ev.Name { @@ -589,13 +626,15 @@ func (a *Application) onDelete() { confirmDialog.Hide() a.deleteConfirming = false a.deleteCurrentWord() - // Restore original key handler + // Restore original handlers a.window.Canvas().SetOnTypedKey(oldKeyHandler) + a.window.Canvas().SetOnTypedRune(oldRuneHandler) case fyne.KeyN, fyne.KeyEscape: confirmDialog.Hide() a.deleteConfirming = false - // Restore original key handler + // Restore original handlers a.window.Canvas().SetOnTypedKey(oldKeyHandler) + a.window.Canvas().SetOnTypedRune(oldRuneHandler) } } else if oldKeyHandler != nil { oldKeyHandler(ev) |
