remove named return values from Dig and ToKey

This commit is contained in:
Daisuke Maki 2026-02-20 22:48:08 +09:00
parent 76f0724099
commit 6d97fcaa0f
2 changed files with 4 additions and 4 deletions

View file

@ -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
}

View file

@ -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)