mirror of
https://github.com/peco/peco.git
synced 2026-09-10 07:16:29 -04:00
remove named return values from Dig and ToKey
This commit is contained in:
parent
76f0724099
commit
6d97fcaa0f
|
|
@ -244,8 +244,8 @@ func KeyEventToString(key KeyType, ch rune, mod ModifierKey) (string, error) {
|
|||
}
|
||||
|
||||
// ToKey parses a single key name string into its KeyType, modifier, and rune components.
|
||||
func ToKey(key string) (k KeyType, modifier ModifierKey, ch rune, err error) {
|
||||
modifier = ModNone
|
||||
func ToKey(key string) (KeyType, ModifierKey, rune, error) {
|
||||
modifier := ModNone
|
||||
|
||||
// Try full string first. This handles legacy key names like "C-a",
|
||||
// "C-v", "Home", "ArrowLeft", etc. that are registered in stringToKey.
|
||||
|
|
@ -284,7 +284,7 @@ func ToKey(key string) (k KeyType, modifier ModifierKey, ch rune, err error) {
|
|||
|
||||
done:
|
||||
// Try as a single rune (handles multi-byte chars like "せ")
|
||||
ch, _ = utf8.DecodeRuneInString(key)
|
||||
ch, _ := utf8.DecodeRuneInString(key)
|
||||
if ch != utf8.RuneError {
|
||||
return 0, modifier, ch, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ func (n *TernaryNode) Get(k Key) Node {
|
|||
}
|
||||
|
||||
// Dig finds or creates a child node for the given key, returning the node and whether it was newly created.
|
||||
func (n *TernaryNode) Dig(k Key) (node Node, isnew bool) {
|
||||
func (n *TernaryNode) Dig(k Key) (Node, bool) {
|
||||
curr := n.firstChild
|
||||
if curr == nil {
|
||||
n.firstChild = NewTernaryNode(k)
|
||||
|
|
|
|||
Loading…
Reference in a new issue