Skip to content

cannot match tea.KeySpace #288

Answered by meowgorithm
tgirod asked this question in Q&A
Mar 22, 2022 · 4 comments · 3 replies
Discussion options

You must be logged in to vote

Hi! You actually just match on a literal space:

// It's usually simplest to just use the Stringer interface
switch msg.String() {
case " ":
    // It's a space!
}

// The super verbose way
if msg.Type == tea.KeyRunes && string(msg.Runes) == " " {
   // It's a space!
}

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by bashbunni
Comment options

You must be logged in to vote
1 reply
@meowgorithm
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@meowgorithm
Comment options

@tgirod
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
3 participants
Converted from issue

This discussion was converted from issue #264 on April 11, 2022 18:48.