Word wrap in internal editor!
This commit is contained in:
parent
73f227e541
commit
144635668a
28
mail_menu.c
28
mail_menu.c
@ -419,11 +419,14 @@ char *editor(int socket, struct user_record *user, char *quote, char *from) {
|
|||||||
int z;
|
int z;
|
||||||
char *tagline;
|
char *tagline;
|
||||||
|
|
||||||
|
char next_line_buffer[80];
|
||||||
|
|
||||||
|
memset(next_line_buffer, 0, 80);
|
||||||
|
|
||||||
if (quote != NULL) {
|
if (quote != NULL) {
|
||||||
|
//wrap(quote, 65);
|
||||||
for (i=0;i<strlen(quote);i++) {
|
for (i=0;i<strlen(quote);i++) {
|
||||||
|
if (quote[i] == '\r' || lineat == 67) {
|
||||||
if (quote[i] == '\r' || lineat == 68) {
|
|
||||||
if (quotelines == 0) {
|
if (quotelines == 0) {
|
||||||
quotecontent = (char **)malloc(sizeof(char *));
|
quotecontent = (char **)malloc(sizeof(char *));
|
||||||
} else {
|
} else {
|
||||||
@ -448,10 +451,25 @@ char *editor(int socket, struct user_record *user, char *quote, char *from) {
|
|||||||
s_putstring(socket, "\e[1;30m-------------------------------------------------------------------------------\e[0m");
|
s_putstring(socket, "\e[1;30m-------------------------------------------------------------------------------\e[0m");
|
||||||
|
|
||||||
while(!doquit) {
|
while(!doquit) {
|
||||||
sprintf(prompt, "\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m", lines);
|
sprintf(prompt, "\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s", lines, next_line_buffer);
|
||||||
s_putstring(socket, prompt);
|
s_putstring(socket, prompt);
|
||||||
s_readstring(socket, linebuffer, 70);
|
strcpy(linebuffer, next_line_buffer);
|
||||||
if (linebuffer[0] == '/') {
|
s_readstring(socket, &linebuffer[strlen(next_line_buffer)], 70 - strlen(next_line_buffer));
|
||||||
|
memset(next_line_buffer, 0, 70);
|
||||||
|
|
||||||
|
if (strlen(linebuffer) == 70 && linebuffer[69] != ' ') {
|
||||||
|
for (i=strlen(linebuffer) - 1;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') {
|
if (toupper(linebuffer[1]) == 'S') {
|
||||||
for (i=0;i<lines;i++) {
|
for (i=0;i<lines;i++) {
|
||||||
size += strlen(content[i]) + 1;
|
size += strlen(content[i]) + 1;
|
||||||
|
Reference in New Issue
Block a user