comparison src/w32console.c @ 24755:3bb855a40bf6

(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.
author Andrew Innes <andrewi@gnu.org>
date Sat, 22 May 1999 17:37:18 +0000
parents 1fa5f9f5c92e
children a4c871b96d4b
comparison
equal deleted inserted replaced
24754:b900ed44aab2 24755:3bb855a40bf6
121 clear_frame (void) 121 clear_frame (void)
122 { 122 {
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);
133 FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r); 137 FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
134 138
331 register unsigned int glyph_len = GLYPH_TABLE_LENGTH; 335 register unsigned int glyph_len = GLYPH_TABLE_LENGTH;
332 Lisp_Object *glyph_table = GLYPH_TABLE_BASE; 336 Lisp_Object *glyph_table = GLYPH_TABLE_BASE;
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;
349 } 351 }
350 352
377 } 379 }
378 380
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);
391 } 389 }
392 390