summaryrefslogtreecommitdiff
path: root/src/w32console.c
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2018-08-26 15:10:50 -0700
committerGlenn Morris <rgm@gnu.org>2018-08-26 15:10:50 -0700
commit1afd313334c93cb5b0a7a378bd635a54dc1d6a9e (patch)
treecb95ad44d35f9b32a8acc8bb00b7291f38549c52 /src/w32console.c
parent18d52b90a1692a47cea5b5e905a58a3b2c6c9a64 (diff)
parent54fb383af6f6af7b72c28f38b308d9b24d2af4f6 (diff)
downloademacs-1afd313334c93cb5b0a7a378bd635a54dc1d6a9e.tar.gz
Merge from origin/emacs-26
54fb383 (origin/emacs-26) Fix detection of freed emacs_values (Bug#32... 769d0cd ; Fix out-of-tree build for mod-test.so 9a1329e Avoid crashes with very wide TTY frames on MS-Windows 9a613d3 Prevent `modify-file-local-variable-prop-line' from adding ex... 624e7dc Update GNOME bugtracker URLs 51ef6d5 Clarify in the Emacs manual that ChangeLog files are not used 6e08019 Recognize codepage 65001 as a valid encoding 1a350d7 ; * etc/NEWS: Fix format of first lines of some entries. 22d1f53 Avoid compilation warning in nt/addpm.c 7bc9ce7 Fix duplicate custom group names in bibtex.el a9cf938 Fix outdated text in the Calc manual Conflicts: etc/NEWS etc/PROBLEMS src/emacs-module.c src/gtkutil.c src/image.c src/xterm.c test/Makefile.in
Diffstat (limited to 'src/w32console.c')
-rw-r--r--src/w32console.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/w32console.c b/src/w32console.c
index 6c3cf06bfd3..9f9db68f0ef 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -140,23 +140,36 @@ w32con_clear_frame (struct frame *f)
}
-static struct glyph glyph_base[256];
+static struct glyph glyph_base[80];
+static struct glyph *glyphs = glyph_base;
+static size_t glyphs_len = ARRAYELTS (glyph_base);
static BOOL ceol_initialized = FALSE;
/* Clear from Cursor to end (what's "standout marker"?). */
static void
w32con_clear_end_of_line (struct frame *f, int end)
{
+ /* Time to reallocate our "empty row"? With today's large screens,
+ it is not unthinkable to see TTY frames well in excess of
+ 80-character width. */
+ if (end - cursor_coords.X > glyphs_len)
+ {
+ if (glyphs == glyph_base)
+ glyphs = NULL;
+ glyphs = xrealloc (glyphs, FRAME_COLS (f) * sizeof (struct glyph));
+ glyphs_len = FRAME_COLS (f);
+ ceol_initialized = FALSE;
+ }
if (!ceol_initialized)
{
int i;
- for (i = 0; i < 256; i++)
+ for (i = 0; i < glyphs_len; i++)
{
- memcpy (&glyph_base[i], &space_glyph, sizeof (struct glyph));
+ memcpy (&glyphs[i], &space_glyph, sizeof (struct glyph));
}
ceol_initialized = TRUE;
}
- w32con_write_glyphs (f, glyph_base, end - cursor_coords.X); /* fencepost ? */
+ w32con_write_glyphs (f, glyphs, end - cursor_coords.X);
}
/* Insert n lines at vpos. if n is negative delete -n lines. */
@@ -772,6 +785,15 @@ initialize_w32_display (struct terminal *term, int *width, int *height)
*width = 1 + info.srWindow.Right - info.srWindow.Left;
}
+ /* Force reinitialization of the "empty row" buffer, in case they
+ dumped from a running session. */
+ if (glyphs != glyph_base)
+ {
+ glyphs = NULL;
+ glyphs_len = 0;
+ ceol_initialized = FALSE;
+ }
+
if (os_subtype == OS_NT)
w32_console_unicode_input = 1;
else