summaryrefslogtreecommitdiff
path: root/src/msdos.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2001-11-23 17:16:17 +0000
committerEli Zaretskii <eliz@gnu.org>2001-11-23 17:16:17 +0000
commitdeece6f51a419739abb1eba6cde42677643e5510 (patch)
treeecac01079face97d1375078430542917194aff0c /src/msdos.c
parent792e1bc441fa3c2e7072b96d4986ee6fabea83d9 (diff)
downloademacs-deece6f51a419739abb1eba6cde42677643e5510.tar.gz
(IT_clear_screen): If the frame's faces are not yet
realized, use the initial screen colors to clear the screen.
Diffstat (limited to 'src/msdos.c')
-rw-r--r--src/msdos.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/msdos.c b/src/msdos.c
index fdf8b078b3c..68386b95581 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -413,6 +413,10 @@ extern int unibyte_display_via_language_environment;
Lisp_Object Qbar;
+/* The screen colors of the curent frame, which serve as the default
+ colors for newly-created frames. */
+static int initial_screen_colors[2];
+
#if __DJGPP__ > 1
/* Update the screen from a part of relocated DOS/V screen buffer which
begins at OFFSET and includes COUNT characters. */
@@ -1797,7 +1801,16 @@ IT_clear_screen (void)
{
if (termscript)
fprintf (termscript, "<CLR:SCR>");
- IT_set_face (0);
+ /* We are sometimes called (from clear_garbaged_frames) when a new
+ frame is being created, but its faces are not yet realized. In
+ such a case we cannot call IT_set_face, since it will fail to find
+ any valid faces and will abort. Instead, use the initial screen
+ colors; that should mimic what a Unix tty does, which simply clears
+ the screen with whatever default colors are in use. */
+ if (FACE_FROM_ID (SELECTED_FRAME (), DEFAULT_FACE_ID) == NULL)
+ ScreenAttrib = (initial_screen_colors[0] << 4) | initial_screen_colors[1];
+ else
+ IT_set_face (0);
mouse_off ();
ScreenClear ();
if (screen_virtual_segment)
@@ -2275,9 +2288,6 @@ IT_set_terminal_window (int foo)
/* Remember the screen colors of the curent frame, to serve as the
default colors for newly-created frames. */
-
-static int initial_screen_colors[2];
-
DEFUN ("msdos-remember-default-colors", Fmsdos_remember_default_colors,
Smsdos_remember_default_colors, 1, 1, 0,
"Remember the screen colors of the current frame.")