Fixed wordwrap bug in internal editor
This commit is contained in:
parent
edb7209a9b
commit
c98ad14aef
@ -23,6 +23,10 @@ LINE: 277 NEW
|
||||
OLDSTRING: (NONE)
|
||||
NEWSTRING: "\r\nScan for new personal mail? (Y/N/S): "
|
||||
|
||||
LINE: 88 MODIFIED
|
||||
OLDSTRING: "\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s"
|
||||
NEWSTRING: "\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m"
|
||||
|
||||
Changes from v0.8-alpha -> v0.9-alpha
|
||||
--------------------------------------------------------------
|
||||
LINE: 255 NEW
|
||||
|
2
dist/magicka.strings
vendored
2
dist/magicka.strings
vendored
@ -86,7 +86,7 @@ Sorry, you don't have permission to upload in this Sub\r\n
|
||||
\r\nUse external editor? (Y/N)
|
||||
\r\n\e[1;32mMagicka Internal Editor, Type \e[1;37m/S \e[1;32mto save, \e[1;37m/A \e[1;32mto abort and \e[1;37m/? \e[1;32mfor help\r\n
|
||||
\e[1;30m-------------------------------------------------------------------------------\e[0m
|
||||
\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s
|
||||
\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m
|
||||
\r\nNo message to quote!\r\n
|
||||
\r\nQuote from Line:
|
||||
\r\nQuote to Line:
|
||||
|
43
src/bbs.c
43
src/bbs.c
@ -537,6 +537,49 @@ char s_getc() {
|
||||
return (char)c;
|
||||
}
|
||||
|
||||
void s_readstring_inject(char *buffer, int max, char *inject) {
|
||||
int i;
|
||||
char c;
|
||||
|
||||
memset(buffer, 0, max);
|
||||
|
||||
if (strlen(inject) > max) {
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(buffer, inject);
|
||||
|
||||
s_printf("%s", inject);
|
||||
|
||||
for (i=strlen(buffer);i<max;i++) {
|
||||
c = s_getchar();
|
||||
|
||||
if ((c == '\b' || c == 127) && i > 0) {
|
||||
buffer[i-1] = '\0';
|
||||
i -= 2;
|
||||
s_printf("\e[D \e[D");
|
||||
continue;
|
||||
} else if (c == '\b' || c == 127) {
|
||||
i -= 1;
|
||||
continue;
|
||||
} else if (c == 27) {
|
||||
c = s_getchar();
|
||||
if (c == 91) {
|
||||
c = s_getchar();
|
||||
}
|
||||
i -= 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '\n' || c == '\r') {
|
||||
return;
|
||||
}
|
||||
s_putchar(c);
|
||||
buffer[i] = c;
|
||||
buffer[i+1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
void s_readstring(char *buffer, int max) {
|
||||
int i;
|
||||
char c;
|
||||
|
@ -262,6 +262,7 @@ extern void s_displayansi(char *file);
|
||||
extern char s_getchar();
|
||||
extern void s_readpass(char *buffer, int max);
|
||||
extern void s_readstring(char *buffer, int max);
|
||||
extern void s_readstring_inject(char *buffer, int max, char *inject);
|
||||
extern char s_getc();
|
||||
extern void disconnect(char *calledby);
|
||||
extern void display_info();
|
||||
|
@ -621,9 +621,9 @@ char *editor(struct user_record *user, char *quote, int quotelen, char *from, in
|
||||
s_printf(get_string(87));
|
||||
|
||||
while(!doquit) {
|
||||
s_printf(get_string(88), lines, next_line_buffer);
|
||||
s_printf(get_string(88), lines);
|
||||
strcpy(linebuffer, next_line_buffer);
|
||||
s_readstring(&linebuffer[strlen(next_line_buffer)], 70 - strlen(next_line_buffer));
|
||||
s_readstring_inject(linebuffer, 70, next_line_buffer);
|
||||
memset(next_line_buffer, 0, 70);
|
||||
|
||||
if (strlen(linebuffer) == 70 && linebuffer[69] != ' ') {
|
||||
|
@ -859,7 +859,6 @@ int www_handler(void * cls, struct MHD_Connection * connection, const char * url
|
||||
} else if (strcasecmp(url, "/files/areas/") == 0 || strcasecmp(url, "/files/areas") == 0) {
|
||||
page = www_files_areas();
|
||||
whole_page = (char *)malloc(strlen(header) + strlen(page) + strlen(footer) + 1);
|
||||
|
||||
sprintf(whole_page, "%s%s%s", header, page, footer);
|
||||
} else if (strncasecmp(url, "/files/areas/", 13) == 0) {
|
||||
file_dir = -1;
|
||||
|
Reference in New Issue
Block a user