Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textarea, how to handle linebreaks? #800

Closed
1F47E opened this issue Aug 14, 2023 · 4 comments
Closed

textarea, how to handle linebreaks? #800

1F47E opened this issue Aug 14, 2023 · 4 comments

Comments

@1F47E
Copy link

1F47E commented Aug 14, 2023

Hi there!
I'm building chat TUI app where I have textarea as text input.

I'm stuck with 2 issues right now:

  1. 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?

  2. 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!

@milanglacier
Copy link

This should be fixed once this PR is merged: #397

@nadimkobeissi
Copy link

Please merge this!

@meowgorithm
Copy link
Member

Hi! #397 is in the process of being merged, however we don't have an ETA yet. A proper bracketed paste solution is nuanced and will require additional work beyond the PR.

@meowgorithm
Copy link
Member

Hi! Bubble Tea supports bracketed paste as of v0.26.0. If you’re still having trouble here please reopen the issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants