-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Allow manual multiline messages #182
Comments
Related to #156 where a user may attempt to paste a multi-line message in one go. |
👍 |
Any progress on this? |
I stumbled upon this Ncurses Multi-Line Text Editor and not being a programmer I don't know if this could be reused for profanity.
|
Thanks a lot for researching this! |
mcabber does this via a
Is actually ncurses only, but we use readline to handle the line editing. Maybe we can look at rlwrap for inspiration. |
I was able to work around this with a simple Python plugin (inspired by @boothj5's syscmd.py) that allows one to use e.g. import prof
from subprocess import Popen, PIPE
def _cmd_printf(format):
if not format:
prof.cons_bad_cmd_usage("/printf")
return
try:
cmd_string = '"' + format + '"'
result = Popen("printf " + cmd_string, shell=True, stdout=PIPE).stdout.read()
prof.send_line(result)
except Exception as e:
prof.cons_show("Internal error: " + repr(e))
# TODO: real error handling
def prof_init(version, status, account_name, fulljid):
synopsis = ["/printf <format-string>"]
description = "Use your system's printf to send a formatted message"
args = [["<format-string>", "the format string to print"]]
examples = ["/printf \"this message will display\\non multiple lines\"",
"/printf \"my home directory is $HOME\"",
"/printf \"here are the contents of my clipboard:\\n$(xclip -o)\""]
prof.register_command("/printf", 1, 1, synopsis, description, args, examples, _cmd_printf)
prof.filepath_completer_add("/printf") It needs work and has only been tested on my system, but it's an easy way to send arbitrary multiline messages, with the added benefit of being able to incorporate the output of shell commands. Feel free to modify/suggest changes, it's still kind of a rough draft. |
Also there is some workaround using Ctrl+V (^V) and Ctrl+J (^J):
|
pasis found: https://github.com/ulfalizer/readline-and-ncurses |
As @kaffeekanne mentioned we have an |
And there's a shortcut that spawns the editor, per default alt+c |
Allow users to send multiline messages, using ctrl-enter or some keyboard combination for the new lines.
Up/down arrow should behave accordingly and move through the message rather than previous commands.
The text was updated successfully, but these errors were encountered: