aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2007-11-30 13:57:21 +0000
committerJason Rumney2007-11-30 13:57:21 +0000
commit09320d303ee2b895141778ffd620a7c82b958b08 (patch)
treeb73655947226fe714c37945aedd164891f568395 /src
parent8d05ec5127d5ca4958c99fb06d6874508f2f4730 (diff)
downloademacs-09320d303ee2b895141778ffd620a7c82b958b08.tar.gz
emacs-09320d303ee2b895141778ffd620a7c82b958b08.zip
(w32con_ins_del_lines, scroll_line): Clip to window.
(w32con_reset_terminal_modes): Clear screen buffer. (vga_stdcolor_name): Remove.
Diffstat (limited to 'src')
-rw-r--r--src/w32console.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/src/w32console.c b/src/w32console.c
index 77cc5001f8f..ad0b33e0703 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -164,6 +164,7 @@ w32con_ins_del_lines (struct frame *f, int vpos, int n)
164{ 164{
165 int i, nb; 165 int i, nb;
166 SMALL_RECT scroll; 166 SMALL_RECT scroll;
167 SMALL_RECT clip;
167 COORD dest; 168 COORD dest;
168 CHAR_INFO fill; 169 CHAR_INFO fill;
169 170
@@ -179,15 +180,16 @@ w32con_ins_del_lines (struct frame *f, int vpos, int n)
179 scroll.Bottom = FRAME_LINES (f) - n; 180 scroll.Bottom = FRAME_LINES (f) - n;
180 dest.Y = vpos + n; 181 dest.Y = vpos + n;
181 } 182 }
182 scroll.Left = 0; 183 clip.Top = clip.Left = scroll.Left = 0;
183 scroll.Right = FRAME_COLS (f); 184 clip.Right = scroll.Right = FRAME_COLS (f);
185 clip.Bottom = FRAME_LINES (f);
184 186
185 dest.X = 0; 187 dest.X = 0;
186 188
187 fill.Char.AsciiChar = 0x20; 189 fill.Char.AsciiChar = 0x20;
188 fill.Attributes = char_attr_normal; 190 fill.Attributes = char_attr_normal;
189 191
190 ScrollConsoleScreenBuffer (cur_screen, &scroll, NULL, dest, &fill); 192 ScrollConsoleScreenBuffer (cur_screen, &scroll, &clip, dest, &fill);
191 193
192 /* Here we have to deal with a w32 console flake: If the scroll 194 /* Here we have to deal with a w32 console flake: If the scroll
193 region looks like abc and we scroll c to a and fill with d we get 195 region looks like abc and we scroll c to a and fill with d we get
@@ -235,12 +237,13 @@ scroll_line (struct frame *f, int dist, int direction)
235{ 237{
236 /* The idea here is to implement a horizontal scroll in one line to 238 /* The idea here is to implement a horizontal scroll in one line to
237 implement delete and half of insert. */ 239 implement delete and half of insert. */
238 SMALL_RECT scroll; 240 SMALL_RECT scroll, clip;
239 COORD dest; 241 COORD dest;
240 CHAR_INFO fill; 242 CHAR_INFO fill;
241 243
242 scroll.Top = cursor_coords.Y; 244 clip.Top = scroll.Top = clip.Bottom = scroll.Bottom = cursor_coords.Y;
243 scroll.Bottom = cursor_coords.Y; 245 clip.Left = 0;
246 clip.Right = FRAME_COLS (f);
244 247
245 if (direction == LEFT) 248 if (direction == LEFT)
246 { 249 {
@@ -259,7 +262,7 @@ scroll_line (struct frame *f, int dist, int direction)
259 fill.Char.AsciiChar = 0x20; 262 fill.Char.AsciiChar = 0x20;
260 fill.Attributes = char_attr_normal; 263 fill.Attributes = char_attr_normal;
261 264
262 ScrollConsoleScreenBuffer (cur_screen, &scroll, NULL, dest, &fill); 265 ScrollConsoleScreenBuffer (cur_screen, &scroll, &clip, dest, &fill);
263} 266}
264 267
265 268
@@ -417,11 +420,31 @@ SOUND is nil to use the normal beep. */)
417static void 420static void
418w32con_reset_terminal_modes (struct terminal *t) 421w32con_reset_terminal_modes (struct terminal *t)
419{ 422{
423 COORD dest;
424 CONSOLE_SCREEN_BUFFER_INFO info;
425 int n;
426 DWORD r;
427
428 /* Clear the complete screen buffer. This is required because Emacs
429 sets the cursor position to the top of the buffer, but there might
430 be other output below the bottom of the Emacs frame if the screen buffer
431 is larger than the window size. */
432 GetConsoleScreenBufferInfo (cur_screen, &info);
433 dest.X = 0;
434 dest.Y = 0;
435 n = info.dwSize.X * info.dwSize.Y;
436
437 FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r);
438 FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
439 /* Now that the screen is clear, put the cursor at the top. */
440 SetConsoleCursorPosition (cur_screen, dest);
441
420#ifdef USE_SEPARATE_SCREEN 442#ifdef USE_SEPARATE_SCREEN
421 SetConsoleActiveScreenBuffer (prev_screen); 443 SetConsoleActiveScreenBuffer (prev_screen);
422#else 444#else
423 SetConsoleCursorInfo (prev_screen, &prev_console_cursor); 445 SetConsoleCursorInfo (prev_screen, &prev_console_cursor);
424#endif 446#endif
447
425 SetConsoleMode (keyboard_handle, prev_console_mode); 448 SetConsoleMode (keyboard_handle, prev_console_mode);
426} 449}
427 450