Hi there!
I'm building chat TUI app where I have textarea as text input.
I'm stuck with 2 issues right now:
-
I can't distinguish line breaks in the message from tea.KeyEnter. For example when multiline text is pasted from clipboard to textarea. Is it possible somehow pre process text form textarea to remove line breaks so that tea.KeyEnter will be not triggered in Update?
-
I cant find key combination of shift + enter for the line break while entering text inside textarea. I'm using tab right now for that. Using keypress as string "shift+enter" doesn't work.
switch keypress := msg.String(); keypress {
case "ctrl+enter":
m.textarea.SetValue(m.textarea.Value() + "\n")
}
I can go with multiline route
ta.KeyMap.InsertNewline.SetEnabled(true)
But then still need a key to send a message like shift+enter or ctrl+enter
Please point me in the right direction if there is any. Thanks!
Hi there!
I'm building chat TUI app where I have textarea as text input.
I'm stuck with 2 issues right now:
I can't distinguish line breaks in the message from tea.KeyEnter. For example when multiline text is pasted from clipboard to textarea. Is it possible somehow pre process text form textarea to remove line breaks so that tea.KeyEnter will be not triggered in Update?
I cant find key combination of shift + enter for the line break while entering text inside textarea. I'm using tab right now for that. Using keypress as string "shift+enter" doesn't work.
I can go with multiline route
But then still need a key to send a message like shift+enter or ctrl+enter
Please point me in the right direction if there is any. Thanks!