mirror of
https://github.com/jixishi/SerialTerminalForWindowsTerminal.git
synced 2026-06-16 00:52:44 +00:00
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:
@@ -66,6 +66,7 @@ func Run() {
|
||||
if cfg.EnableGUI {
|
||||
model := tui.New(appInst)
|
||||
p := tea.NewProgram(model, tea.WithAltScreen(), tea.WithoutSignalHandler())
|
||||
enableVTInput(int(os.Stdin.Fd())) // Restore VT input for Ctrl+Alt+Key hotkeys
|
||||
if _, err = p.Run(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "tui failed: %v\n", err)
|
||||
os.Exit(1)
|
||||
@@ -336,13 +337,7 @@ func isExitHotkeySeq(seq []byte, cfg *config.Config) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func normalizeHotkey(mod string) string {
|
||||
mod = strings.ToLower(strings.TrimSpace(mod))
|
||||
if mod != "ctrl+alt" && mod != "ctrl+shift" {
|
||||
mod = "ctrl+alt"
|
||||
}
|
||||
return mod
|
||||
}
|
||||
func normalizeHotkey(mod string) string { return config.NormalizeHotkey(mod) }
|
||||
|
||||
func echoConsoleByte(out io.Writer, b byte) { _, _ = out.Write([]byte{b}) }
|
||||
func echoConsoleNewline(out io.Writer) { _, _ = io.WriteString(out, "\r\n") }
|
||||
|
||||
Reference in New Issue
Block a user