aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Innes1999-05-22 17:37:18 +0000
committerAndrew Innes1999-05-22 17:37:18 +0000
commita5404e3acff33b3edb5136d5271f7e8b04cde2a1 (patch)
treec0cd535a22c35ba4026966ead0ba13ae82758789 /src
parent20606274270ed6a3e3b0744b97905e0f6640a760 (diff)
downloademacs-a5404e3acff33b3edb5136d5271f7e8b04cde2a1.tar.gz
emacs-a5404e3acff33b3edb5136d5271f7e8b04cde2a1.zip
(clear_frame): Remember that the window width might
be smaller than the screen buffer width. (write_glyphs): Remove redundant variable attrs. Use FillConsoleOutputAttribute instead of WriteConsoleOutputAttribute.
Diffstat (limited to 'src')
-rw-r--r--src/w32console.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/w32console.c b/src/w32console.c
index 687203025fd..c0859f8f204 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -123,10 +123,14 @@ clear_frame (void)
123 FRAME_PTR f = PICK_FRAME (); 123 FRAME_PTR f = PICK_FRAME ();
124 COORD dest; 124 COORD dest;
125 int n, r; 125 int n, r;
126 CONSOLE_SCREEN_BUFFER_INFO info;
127
128 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info);
126 129
127 hl_mode (0); 130 hl_mode (0);
128 131
129 n = FRAME_HEIGHT (f) * FRAME_WIDTH (f); 132 /* Remember that the screen buffer might be wider than the window. */
133 n = FRAME_HEIGHT (f) * info.dwSize.X;
130 dest.X = dest.Y = 0; 134 dest.X = dest.Y = 0;
131 135
132 FillConsoleOutputAttribute (cur_screen, char_attr, n, dest, &r); 136 FillConsoleOutputAttribute (cur_screen, char_attr, n, dest, &r);
@@ -333,16 +337,14 @@ write_glyphs (register GLYPH *string, register int len)
333 FRAME_PTR f = PICK_FRAME (); 337 FRAME_PTR f = PICK_FRAME ();
334 register char *ptr; 338 register char *ptr;
335 GLYPH glyph; 339 GLYPH glyph;
336 WORD *attrs;
337 char *chars; 340 char *chars;
338 int i; 341 int i;
339 342
340 if (len <= 0) 343 if (len <= 0)
341 return; 344 return;
342 345
343 attrs = alloca (len * sizeof (*attrs));
344 chars = alloca (len * sizeof (*chars)); 346 chars = alloca (len * sizeof (*chars));
345 if (attrs == NULL || chars == NULL) 347 if (chars == NULL)
346 { 348 {
347 printf ("alloca failed in write_glyphs\n"); 349 printf ("alloca failed in write_glyphs\n");
348 return; 350 return;
@@ -379,12 +381,8 @@ write_glyphs (register GLYPH *string, register int len)
379 /* Number of characters we have in the buffer. */ 381 /* Number of characters we have in the buffer. */
380 len = ptr-chars; 382 len = ptr-chars;
381 383
382 /* Fill in the attributes for these characters. */ 384 /* Set the attribute for these characters. */
383 for (i = 0; i < len; i++) 385 if (!FillConsoleOutputAttribute (cur_screen, char_attr, len, cursor_coords, &i))
384 attrs[i] = char_attr;
385
386 /* Write the attributes. */
387 if (!WriteConsoleOutputAttribute (cur_screen, attrs, len, cursor_coords, &i))
388 { 386 {
389 printf ("Failed writing console attributes: %d\n", GetLastError ()); 387 printf ("Failed writing console attributes: %d\n", GetLastError ());
390 fflush (stdout); 388 fflush (stdout);