Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-95
[bpt/emacs.git] / src / term.c
index c8c34ff..0a40993 100644 (file)
@@ -1,6 +1,6 @@
 /* Terminal control module for terminals described by TERMCAP
-   Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002, 2005
-   Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1998, 2000, 2001,
+                 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -451,7 +451,17 @@ set_terminal_modes ()
 {
   if (FRAME_TERMCAP_P (XFRAME (selected_frame)))
     {
-      OUTPUT_IF (TS_termcap_modes);
+      if (TS_termcap_modes)
+       OUTPUT (TS_termcap_modes);
+      else
+       {
+         /* Output enough newlines to scroll all the old screen contents
+            off the screen, so it won't be overwritten and lost.  */
+         int i;
+         for (i = 0; i < FRAME_LINES (XFRAME (selected_frame)); i++)
+           putchar ('\n');
+       }
+
       OUTPUT_IF (TS_cursor_visible);
       OUTPUT_IF (TS_keypad_mode);
       losecursor ();
@@ -810,7 +820,7 @@ encode_terminal_code (src, src_len, coding)
      int src_len;
      struct coding_system *coding;
 {
-  struct glyph *src_start = src, *src_end = src + src_len;
+  struct glyph *src_end = src + src_len;
   register GLYPH g;
   unsigned char *buf;
   int nchars, nbytes, required;
@@ -1826,7 +1836,7 @@ produce_stretch_glyph (it)
           && calc_pixel_width_or_height (&tem, it, prop, 0, 1, &align_to))
     {
       if (it->glyph_row == NULL || !it->glyph_row->mode_line_p)
-       align_to = (align_to < 0 
+       align_to = (align_to < 0
                    ? 0
                    : align_to - window_box_left_offset (it->w, TEXT_AREA));
       else if (align_to < 0)
@@ -2019,24 +2029,20 @@ turn_on_face (f, face_id)
 
   if (TN_max_colors > 0)
     {
-      char *p;
+      char *ts, *p;
 
-      if (fg >= 0 && TS_set_foreground)
+      ts = standout_mode ? TS_set_background : TS_set_foreground;
+      if (fg >= 0 && ts)
        {
-         if (standout_mode)
-           p = tparam (TS_set_background, NULL, 0, (int) fg);
-         else
-           p = tparam (TS_set_foreground, NULL, 0, (int) fg);
+         p = tparam (ts, NULL, 0, (int) fg);
          OUTPUT (p);
          xfree (p);
        }
 
-      if (bg >= 0 && TS_set_background)
+      ts = standout_mode ? TS_set_foreground : TS_set_background;
+      if (bg >= 0 && ts)
        {
-         if (standout_mode)
-           p = tparam (TS_set_foreground, NULL, 0, (int) bg);
-         else
-           p = tparam (TS_set_background, NULL, 0, (int) bg);
+         p = tparam (ts, NULL, 0, (int) bg);
          OUTPUT (p);
          xfree (p);
        }