aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Innes1999-07-09 13:38:11 +0000
committerAndrew Innes1999-07-09 13:38:11 +0000
commit191100f2aa7d0cffac2ab6ba91ae634e7e3f9c65 (patch)
treefd99bde28b960baa8cb7c25201eb87442c52072b /src
parentd44c074d09f192098069032f536bbba42af5d130 (diff)
downloademacs-191100f2aa7d0cffac2ab6ba91ae634e7e3f9c65.tar.gz
emacs-191100f2aa7d0cffac2ab6ba91ae634e7e3f9c65.zip
(w32_use_full_screen_buffer): New variable.
(syms_of_ntterm): Register it. (initialize_w32_display): Set initial frame size accordingly, respecting the LINES and COLUMNS environment variables if set.
Diffstat (limited to 'src')
-rw-r--r--src/w32console.c69
1 files changed, 63 insertions, 6 deletions
diff --git a/src/w32console.c b/src/w32console.c
index c0859f8f204..6b7331fbd3c 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -76,6 +76,12 @@ DWORD prev_console_mode;
76CONSOLE_CURSOR_INFO prev_console_cursor; 76CONSOLE_CURSOR_INFO prev_console_cursor;
77#endif 77#endif
78 78
79/* Determine whether to make frame dimensions match the screen buffer,
80 or the current window size. The former is desirable when running
81 over telnet, while the latter is more useful when working directly at
82 the console with a large scroll-back buffer. */
83int w32_use_full_screen_buffer;
84
79 85
80/* Setting this as the ctrl handler prevents emacs from being killed when 86/* Setting this as the ctrl handler prevents emacs from being killed when
81 someone hits ^C in a 'suspended' session (child shell). 87 someone hits ^C in a 'suspended' session (child shell).
@@ -563,6 +569,40 @@ initialize_w32_display (void)
563 GetConsoleCursorInfo (prev_screen, &prev_console_cursor); 569 GetConsoleCursorInfo (prev_screen, &prev_console_cursor);
564#endif 570#endif
565 571
572 /* Respect setting of LINES and COLUMNS environment variables. */
573 {
574 char * lines = getenv("LINES");
575 char * columns = getenv("COLUMNS");
576
577 if (lines != NULL && columns != NULL)
578 {
579 SMALL_RECT new_win_dims;
580 COORD new_size;
581
582 new_size.X = atoi (columns);
583 new_size.Y = atoi (lines);
584
585 GetConsoleScreenBufferInfo (cur_screen, &info);
586
587 /* Shrink the window first, so the buffer dimensions can be
588 reduced if necessary. */
589 new_win_dims.Top = 0;
590 new_win_dims.Left = 0;
591 new_win_dims.Bottom = min (new_size.Y, info.dwSize.Y) - 1;
592 new_win_dims.Right = min (new_size.X, info.dwSize.X) - 1;
593 SetConsoleWindowInfo (cur_screen, TRUE, &new_win_dims);
594
595 SetConsoleScreenBufferSize (cur_screen, new_size);
596
597 /* Set the window size to match the buffer dimension. */
598 new_win_dims.Top = 0;
599 new_win_dims.Left = 0;
600 new_win_dims.Bottom = new_size.Y - 1;
601 new_win_dims.Right = new_size.X - 1;
602 SetConsoleWindowInfo (cur_screen, TRUE, &new_win_dims);
603 }
604 }
605
566 GetConsoleScreenBufferInfo (cur_screen, &info); 606 GetConsoleScreenBufferInfo (cur_screen, &info);
567 607
568 meta_key = 1; 608 meta_key = 1;
@@ -570,12 +610,20 @@ initialize_w32_display (void)
570 char_attr_normal = char_attr; 610 char_attr_normal = char_attr;
571 char_attr_reverse = ((char_attr & 0xf) << 4) + ((char_attr & 0xf0) >> 4); 611 char_attr_reverse = ((char_attr & 0xf) << 4) + ((char_attr & 0xf0) >> 4);
572 612
573 /* Lines per page. Use buffer coords instead of buffer size. */ 613 if (w32_use_full_screen_buffer)
574 FRAME_HEIGHT (selected_frame) = 1 + info.srWindow.Bottom - 614 {
575 info.srWindow.Top; 615 FRAME_HEIGHT (selected_frame) = info.dwSize.Y; /* lines per page */
576 /* Characters per line. Use buffer coords instead of buffer size. */ 616 SET_FRAME_WIDTH (selected_frame, info.dwSize.X); /* characters per line */
577 SET_FRAME_WIDTH (selected_frame, 1 + info.srWindow.Right - 617 }
578 info.srWindow.Left); 618 else
619 {
620 /* Lines per page. Use buffer coords instead of buffer size. */
621 FRAME_HEIGHT (selected_frame) = 1 + info.srWindow.Bottom -
622 info.srWindow.Top;
623 /* Characters per line. Use buffer coords instead of buffer size. */
624 SET_FRAME_WIDTH (selected_frame, 1 + info.srWindow.Right -
625 info.srWindow.Left);
626 }
579} 627}
580 628
581DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0, 629DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0,
@@ -624,6 +672,15 @@ glyph_to_pixel_coords (FRAME_PTR f, int x, int y, int *pix_x, int *pix_y)
624void 672void
625syms_of_ntterm () 673syms_of_ntterm ()
626{ 674{
675 DEFVAR_BOOL ("w32-use-full-screen-buffer",
676 &w32_use_full_screen_buffer,
677 "Non-nil means make terminal frames use the full screen buffer dimensions.\n\
678This is desirable when running Emacs over telnet, and is the default.\n\
679A value of nil means use the current console window dimensions; this\n\
680may be preferrable when working directly at the console with a large\n\
681scroll-back buffer.");
682 w32_use_full_screen_buffer = 1;
683
627 defsubr (&Sset_screen_color); 684 defsubr (&Sset_screen_color);
628 defsubr (&Sset_cursor_size); 685 defsubr (&Sset_cursor_size);
629 defsubr (&Sset_message_beep); 686 defsubr (&Sset_message_beep);