commit fa9130a
delthas
·
2025-10-17 16:53:10 +0000 UTC
parent f40c9db
Fix input on Wezterm with Kitty keyboard protocol enabled In that case, Wezterm seems to send text for events that should not be generating them. Sanitize these events to avoid treating them as text events.
1 files changed,
+8,
-0
M
app.go
M
app.go
+8,
-0
1@@ -1038,6 +1038,14 @@ func (app *App) handleKeyEvent(ev vaxis.Key) {
2 default:
3 return
4 }
5+ if len(ev.Text) == 1 && ev.Text[0] < ' ' {
6+ // Drop control characters text (sent by some terminal emulators)
7+ ev.Text = ""
8+ }
9+ if ev.Modifiers&(vaxis.ModCtrl|vaxis.ModAlt|vaxis.ModSuper|vaxis.ModMeta) != 0 {
10+ // Drop text when sent with modifiers preventing text
11+ ev.Text = ""
12+ }
13 if ev.Text != "" {
14 for _, r := range ev.Text {
15 app.win.InputRune(r)