From 144635668a3a8e1291a87977ca4412f5210567c5 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Wed, 13 Apr 2016 22:35:49 +1000 Subject: [PATCH] Word wrap in internal editor! --- mail_menu.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/mail_menu.c b/mail_menu.c index d42d598..68e51e3 100644 --- a/mail_menu.c +++ b/mail_menu.c @@ -419,11 +419,14 @@ char *editor(int socket, struct user_record *user, char *quote, char *from) { int z; char *tagline; + char next_line_buffer[80]; + + memset(next_line_buffer, 0, 80); if (quote != NULL) { + //wrap(quote, 65); for (i=0;i 15;i--) { + if (linebuffer[i] == ' ') { + linebuffer[i] = '\0'; + strcpy(next_line_buffer, &linebuffer[i+1]); + sprintf(prompt, "\e[%dD\e[0K", 70 - i); + s_putstring(socket, prompt); + break; + } + } + } + + if (linebuffer[0] == '/' && strlen(linebuffer) == 2) { if (toupper(linebuffer[1]) == 'S') { for (i=0;i