fix: restore Ctrl+Alt+Key hotkeys and dedup normalizeHotkey

- Call enableVTInput after tea.NewProgram to restore VT input mode
  on Windows (bubbletea v1 conInputReader disables it, breaking
  Ctrl+Alt+Key combos)
- Move normalizeHotkey to internal/config.NormalizeHotkey, eliminate
  duplicate implementations in tui and console packages
- Remove unused Sess() getter from App

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
JiXieShi
2026-05-24 02:45:30 +08:00
parent 9bfb664838
commit 885f6a68cf
3 changed files with 14 additions and 14 deletions
+2 -7
View File
@@ -4,6 +4,7 @@ import (
"strings"
tea "github.com/charmbracelet/bubbletea"
"github.com/jixishi/SerialTerminalForWindowsTerminal/internal/config"
"github.com/jixishi/SerialTerminalForWindowsTerminal/internal/event"
)
@@ -55,13 +56,7 @@ func (m *Model) isLocalHotkey(key, action string) bool {
return hasCtrl && hasAlt
}
func normalizeHotkeyPrefix(mod string) string {
mod = strings.ToLower(strings.TrimSpace(mod))
if mod != "ctrl+alt" && mod != "ctrl+shift" {
mod = "ctrl+alt"
}
return mod
}
func normalizeHotkeyPrefix(mod string) string { return config.NormalizeHotkey(mod) }
func hotkeyWith(mod, action string) string {
return normalizeHotkeyPrefix(mod) + "+" + action