mirror of
https://github.com/Tha14/toxic.git
synced 2025-06-29 11:56:44 +02:00
Enable multiline input
Adds a nonl() call to avoid translation from \r to \n when pressing enter. C-J -> \n Enter -> \r To allow multiline input, \n chars (e.g. when pressing C-J) are replaced with a pilcrow. After hitting enter, every pilcrow is substituted with \n again.
This commit is contained in:
@ -36,6 +36,7 @@
|
||||
#include "avatars.h"
|
||||
#include "name_lookup.h"
|
||||
#include "qr_code.h"
|
||||
#include "toxic_strings.h"
|
||||
|
||||
extern char *DATA_FILE;
|
||||
extern ToxWindow *prompt;
|
||||
@ -513,11 +514,12 @@ void cmd_note(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
|
||||
return;
|
||||
}
|
||||
|
||||
/* remove opening and closing quotes */
|
||||
/* remove opening and closing quotes and replace linebreaks with spaces */
|
||||
char msg[MAX_STR_SIZE];
|
||||
snprintf(msg, sizeof(msg), "%s", &argv[1][1]);
|
||||
int len = strlen(msg) - 1;
|
||||
msg[len] = '\0';
|
||||
strsubst(msg, '\n', ' ');
|
||||
|
||||
prompt_update_statusmessage(prompt, m, msg);
|
||||
}
|
||||
|
Reference in New Issue
Block a user