isamert / scli

a simple terminal user interface for signal messenger (using signal-cli)
GNU General Public License v3.0
444 stars 40 forks source link

Multi-line support #92

Closed vargn closed 3 years ago

vargn commented 3 years ago

At the moment you can't Shift-Enter to add multi-line messages. The same goes for pasting a multi-line message, it will then send the first line and input the next line in message input buffer. I'm a total novice when it comes to programming, and I really have no idea if this is possible. But I can't imagine it would be very complicated to implement, please correct me if I'm wrong?

exquo commented 3 years ago

Thanks for the suggestion! I agree, both the multiline composing with Shift+Enter and the multi-line pasting would be useful.

There are some snags though:

First, Shift+Enter is intercepted by (most) terminal emulators and passed on as just Enter to any terminal applications. See https://stackoverflow.com/questions/598113/can-terminals-detect-shift-enter-or-control-enter Same story for Ctrl+Enter. Alt+Enter does work in my terminal, and I got it working in scli, so it, or some other key combination that works in terminal and urwid, could be added. Looks like currently scli displays multi-line messages in a single line, but that would be another issue: #93.

For pasting multi-line messages: as far as I can tell urwid interprets newlines in the pasted text as enter keypresses, and I don't know how to go around that.. So pasting multi-line messages might not be possible in scli.

remembertoremind commented 3 years ago

Could this be done by using an external editor like vim?

exquo commented 3 years ago

Yes, sending multi-line text composed in external editor (:e in scli) should show up as multi-line messages.

exquo commented 3 years ago

Links to these issues upstream:

Terminals not sending some key combos (Shift + Enter, Ctrl + Enter, etc): urwid/urwid#140

Newlines in pasted multi-line text get interpreted as Enter key presses: urwid/urwid#452

exquo commented 3 years ago

Sending multiline messages is now supported: pasting into the Edit field preserves newlines, and inserting a new line while typing can be done with Alt+Enter.