Experiment with line deletion

This commit is contained in:
Andrew Pamment 2017-09-06 22:07:25 +10:00
parent 59552151fd
commit 150a513c6c

View File

@ -585,13 +585,21 @@ char *message_editor() {
body_lines[i] = body_lines[i+1]; body_lines[i] = body_lines[i+1];
} }
body_line_count--; body_line_count--;
body_lines = (char **)realloc(body_lines, sizeof(char *) * (body_line_count + 1)); if (body_line_count == 0) {
free(body_lines);
} else {
body_lines = (char **)realloc(body_lines, sizeof(char *) * (body_line_count));
}
} else { } else {
if (body_line_count > 0) { if (body_line_count > 0) {
memcpy(line, body_lines[body_line_count -1], 81); memcpy(line, body_lines[body_line_count -1], 81);
free(body_lines[body_line_count - 1]); free(body_lines[body_line_count - 1]);
body_line_count--; body_line_count--;
body_lines = (char **)realloc(body_lines, sizeof(char *) * (body_line_count + 1)); if (body_line_count == 0) {
free(body_lines);
} else {
body_lines = (char **)realloc(body_lines, sizeof(char *) * (body_line_count));
}
position_y--; position_y--;
} else { } else {
memset(line, 0, 81); memset(line, 0, 81);