Update font_height & _width whenever they are used.
authorTimo Korvola <tkorvola@iki.fi>
Fri, 9 Mar 2018 21:38:16 +0000 (23:38 +0200)
committerDavid Griffith <dave@661.org>
Sun, 11 Mar 2018 11:48:51 +0000 (04:48 -0700)
Call os_data(0, &font_height, &font_width) to update.  On those
front ends where it does nothing (curses) it does not matter.

src/common/screen.c

index 0b2b2502895a88bd54cb36ad60fa668b55768fcb..313b415362a244c275130f2dd0e95fddc1a6ee71 100644 (file)
@@ -39,6 +39,7 @@ static struct {
     {   UNKNOWN,  0,   0,   0 }
 };
 
+/* These are usually out of date.  Always update before using. */
 static int font_height = 1;
 static int font_width = 1;
 
@@ -225,6 +226,7 @@ void screen_new_line (void)
 
     cwp->x_cursor = cwp->left + 1;
 
+    os_font_data(0, &font_height, &font_width);
     if (cwp->y_cursor + 2 * font_height - 1 > cwp->y_size)
 
        if (enable_scrolling) {
@@ -402,6 +404,7 @@ void screen_erase_input (const zchar *buf)
        y = cwp->y_pos + cwp->y_cursor - 1;
        x = cwp->x_pos + cwp->x_cursor - 1;
 
+       os_font_data(0, &font_height, &font_width);
        os_erase_area (y, x, y + font_height - 1, x + width - 1, -1);
        os_set_cursor (y, x);
 
@@ -995,6 +998,7 @@ void z_erase_line (void)
     y = cwp->y_pos + cwp->y_cursor - 1;
     x = cwp->x_pos + cwp->x_cursor - 1;
 
+    os_font_data(0, &font_height, &font_width);
     os_erase_area (y, x, y + font_height - 1, x + pixels - 1, -1);
 
 }/* z_erase_line */
@@ -1223,7 +1227,7 @@ void z_print_table (void)
        if (i != 0) {
 
            flush_buffer ();
-
+           os_font_data(0, &font_height, &font_width);
            cwp->y_cursor += font_height;
            cwp->x_cursor = x;