changes to magiedit

This commit is contained in:
Andrew Pamment 2017-03-26 20:24:41 +10:00
parent 0f224ee6d3
commit e475ceb395

View File

@ -44,6 +44,7 @@ char *message_editor() {
int q_unquote; int q_unquote;
int z; int z;
int redraw; int redraw;
int old_top_of_screen = 0;
position_x = 0; position_x = 0;
position_y = 0; position_y = 0;
@ -87,6 +88,7 @@ char *message_editor() {
top_of_screen--; top_of_screen--;
} }
if (old_top_of_screen != top_of_screen) {
od_set_cursor(3, 1); od_set_cursor(3, 1);
for (i=top_of_screen;i<position_y;i++) { for (i=top_of_screen;i<position_y;i++) {
@ -103,7 +105,8 @@ char *message_editor() {
od_clr_line(); od_clr_line();
} }
}
old_top_of_screen = top_of_screen;
od_set_cursor(position_y - top_of_screen + 3, position_x + 1); od_set_cursor(position_y - top_of_screen + 3, position_x + 1);
} }
@ -123,6 +126,7 @@ char *message_editor() {
top_of_screen++; top_of_screen++;
} }
if (old_top_of_screen != top_of_screen) {
od_set_cursor(3, 1); od_set_cursor(3, 1);
for (i=top_of_screen;i<position_y;i++) { for (i=top_of_screen;i<position_y;i++) {
@ -138,7 +142,8 @@ char *message_editor() {
od_printf("%s", body_lines[i]); od_printf("%s", body_lines[i]);
od_clr_line(); od_clr_line();
} }
}
old_top_of_screen = top_of_screen;
od_set_cursor(position_y - top_of_screen + 3, position_x + 1); od_set_cursor(position_y - top_of_screen + 3, position_x + 1);
} }
} else if (ch.chKeyPress == OD_KEY_LEFT) { } else if (ch.chKeyPress == OD_KEY_LEFT) {
@ -404,7 +409,7 @@ char *message_editor() {
memset(line, 0, 81); memset(line, 0, 81);
od_set_cursor(position_y - top_of_screen + 3, position_x + 1); od_set_cursor(position_y - top_of_screen + 3, position_x + 1);
} else { } else {
if (strlen(line) >= 73) { if (strlen(line) >= 73 && ch.chKeyPress != '\r') {
if (position_x == strlen(line)) { if (position_x == strlen(line)) {
strncat(line, &ch.chKeyPress, 1); strncat(line, &ch.chKeyPress, 1);
z = 1; z = 1;
@ -538,6 +543,7 @@ char *message_editor() {
} }
if (old_top_of_screen != top_of_screen) {
od_set_cursor(3, 1); od_set_cursor(3, 1);
for (i=top_of_screen;i<position_y;i++) { for (i=top_of_screen;i<position_y;i++) {
@ -553,7 +559,8 @@ char *message_editor() {
od_printf("%s", body_lines[i]); od_printf("%s", body_lines[i]);
od_clr_line(); od_clr_line();
} }
}
old_top_of_screen = top_of_screen;
od_set_cursor(position_y - top_of_screen + 3, position_x + 1); od_set_cursor(position_y - top_of_screen + 3, position_x + 1);
} }
} else { } else {
@ -594,6 +601,19 @@ char *message_editor() {
} }
if (position_x > 1) {
if (position_y > 20) {
od_set_cursor(23, position_x - 1);
od_clr_line();
} else {
od_set_cursor(position_y + 3, position_x - 1);
od_clr_line();
}
for (i = position_x - 2; i < position_x; i++) {
od_printf("%c", line[i]);
}
} else {
if (position_y > 20) { if (position_y > 20) {
od_set_cursor(23, 1); od_set_cursor(23, 1);
od_clr_line(); od_clr_line();
@ -605,7 +625,7 @@ char *message_editor() {
for (i = 0; i < position_x; i++) { for (i = 0; i < position_x; i++) {
od_printf("%c", line[i]); od_printf("%c", line[i]);
} }
}
if (position_x < strlen(line) ) { if (position_x < strlen(line) ) {
for (i = position_x; i < strlen(line); i++) { for (i = position_x; i < strlen(line); i++) {
od_printf("%c", line[i]); od_printf("%c", line[i]);