getting closer to a properly resizing console

This commit is contained in:
Bill Currie 2001-10-01 06:49:59 +00:00
parent 7fcdffb42e
commit 77cf9439d0

View file

@ -125,31 +125,36 @@ C_DrawOutput (void)
int lines = screen_y - 3; // leave a blank line int lines = screen_y - 3; // leave a blank line
int width = screen_x; int width = screen_x;
int cur_line = output_buffer->cur_line; int cur_line = output_buffer->cur_line;
int i; int i, y;
if (lines < 1) if (lines < 1)
return; return;
for (i = 0; i < lines; i++) { for (y = i = 0; y < lines; i++, y++) {
con_line_t *l = Con_BufferLine (output_buffer, cur_line - i); con_line_t *l = Con_BufferLine (output_buffer, cur_line - i);
if (!l->text) { if (!l->text) {
i--; i--;
break; break;
} }
i += l->len / width; // really dumb line wrap algo :) y += l->len / width; // really dumb line wrap algo :)
} }
cur_line -= min (i, lines); cur_line -= i;
i -= lines; y -= lines;
wclear (output);
wmove (output, 0, 0); wmove (output, 0, 0);
do { do {
con_line_t *l = Con_BufferLine (output_buffer, cur_line++); con_line_t *l = Con_BufferLine (output_buffer, cur_line++);
byte *text = l->text; byte *text = l->text;
int len = l->len; int len = l->len;
if (i > 0) { if (y > 0) {
text += i * width; text += y * width;
len -= i * width; len -= y * width;
i = 0; y = 0;
if (len < 1) {
len = 1;
text = l->text + l->len - 1;
}
} }
while (len--) { while (len--) {
chtype ch = *text++; chtype ch = *text++;