mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-16 18:15:03 -07:00
fix: remove the now-unused hexes key mapping
This became unnecessary when we fixed the support for the Alt modifier on control characters.
This commit is contained in:
committed by
Christian Muehlhaeuser
parent
b074f6f5a4
commit
7e7a729b31
24
key.go
24
key.go
@@ -2,7 +2,6 @@ package tea
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"unicode/utf8"
|
||||
|
||||
@@ -540,18 +539,12 @@ var sequences = map[string]Key{
|
||||
"\x1b\x1b[32~": {Type: KeyF18, Alt: true}, // urxvt
|
||||
"\x1b\x1b[33~": {Type: KeyF19, Alt: true}, // urxvt
|
||||
"\x1b\x1b[34~": {Type: KeyF20, Alt: true}, // urxvt
|
||||
}
|
||||
|
||||
// Hex code mappings.
|
||||
var hexes = map[string]Key{
|
||||
"1b0d": {Type: KeyEnter, Alt: true},
|
||||
"1b7f": {Type: KeyBackspace, Alt: true},
|
||||
|
||||
// Powershell
|
||||
"1b4f41": {Type: KeyUp, Alt: false},
|
||||
"1b4f42": {Type: KeyDown, Alt: false},
|
||||
"1b4f43": {Type: KeyRight, Alt: false},
|
||||
"1b4f44": {Type: KeyLeft, Alt: false},
|
||||
// Powershell sequences.
|
||||
"\x1bOA": {Type: KeyUp, Alt: false},
|
||||
"\x1bOB": {Type: KeyDown, Alt: false},
|
||||
"\x1bOC": {Type: KeyRight, Alt: false},
|
||||
"\x1bOD": {Type: KeyLeft, Alt: false},
|
||||
}
|
||||
|
||||
// readInputs reads keypress and mouse inputs from a TTY and returns messages
|
||||
@@ -617,13 +610,6 @@ func readInputs(input io.Reader) ([]Msg, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Some of these need special handling.
|
||||
hex := fmt.Sprintf("%x", runes)
|
||||
if k, ok := hexes[hex]; ok {
|
||||
msgs = append(msgs, KeyMsg(k))
|
||||
continue
|
||||
}
|
||||
|
||||
// Is this an unrecognized CSI sequence? If so, ignore it.
|
||||
if len(runes) > 2 && runes[0] == 0x1b && (runes[1] == '[' ||
|
||||
(len(runes) > 3 && runes[1] == 0x1b && runes[2] == '[')) {
|
||||
|
||||
Reference in New Issue
Block a user