]> code.delx.au - gnu-emacs/blobdiff - src/dispnew.c
(Vnonascii_translation_table): Name changed from
[gnu-emacs] / src / dispnew.c
index ad7ed32c40a9c85132bcd2f6593a7cae742b6474..609d0b5bf8d5db0ede353a23baced089e0d33f19 100644 (file)
@@ -1,5 +1,6 @@
 /* Updating of data structures for redisplay.
-   Copyright (C) 1985, 86, 87, 88, 93, 94, 95 Free Software Foundation, Inc.
+   Copyright (C) 1985, 86, 87, 88, 93, 94, 95, 97, 1998
+       Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -26,6 +27,10 @@ Boston, MA 02111-1307, USA.  */
 #include <stdio.h>
 #include <ctype.h>
 
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #include "lisp.h"
 #include "termchar.h"
 #include "termopts.h"
@@ -42,6 +47,8 @@ Boston, MA 02111-1307, USA.  */
 #include "indent.h"
 #include "intervals.h"
 #include "blockinput.h"
+#include "process.h"
+#include "keyboard.h"
 
 /* I don't know why DEC Alpha OSF1 fail to compile this file if we
    include the following file.  */
@@ -63,6 +70,8 @@ Boston, MA 02111-1307, USA.  */
 
 #define max(a, b) ((a) > (b) ? (a) : (b))
 #define min(a, b) ((a) < (b) ? (a) : (b))
+#define minmax(floor, val, ceil) \
+       ((val) < (floor) ? (floor) : (val) > (ceil) ? (ceil) : (val))
 
 /* Get number of chars of output now in the buffer of a stdio stream.
    This ought to be built in in stdio, but it isn't.
@@ -184,6 +193,7 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
   return Qnil;
 }
 
+void
 redraw_frame (f)
      FRAME_PTR f;
 {
@@ -226,8 +236,8 @@ make_frame_glyphs (frame, empty)
      int empty;
 {
   register int i;
-  register width = FRAME_WINDOW_WIDTH (frame);
-  register height = FRAME_HEIGHT (frame);
+  register int width = FRAME_WINDOW_WIDTH (frame);
+  register int height = FRAME_HEIGHT (frame);
   register struct frame_glyphs *new
     = (struct frame_glyphs *) xmalloc (sizeof (struct frame_glyphs));
 
@@ -465,6 +475,7 @@ line_draw_cost (m, vpos)
 
 /* cancel_line eliminates any request to display a line at position `vpos' */
 
+void
 cancel_line (vpos, frame)
      int vpos;
      register FRAME_PTR frame;
@@ -472,6 +483,7 @@ cancel_line (vpos, frame)
   FRAME_DESIRED_GLYPHS (frame)->enable[vpos] = 0;
 }
 
+void
 clear_frame_records (frame)
      register FRAME_PTR frame;
 {
@@ -820,6 +832,7 @@ scroll_frame_lines (frame, from, end, amount, newpos)
    into the FRAME_DESIRED_GLYPHS (frame) from the FRAME_PHYS_GLYPHS (frame)
    so that update_frame will not change those columns.  */
 
+void
 preserve_other_columns (w)
      struct window *w;
 {
@@ -944,6 +957,7 @@ adjust_window_charstarts (w, vpos, adjust)
    for internal consistency.  We cannot check that they are "right";
    we can only look for something nonsensical.  */
 
+void
 verify_charstarts (w)
      struct window *w;
 {
@@ -1000,6 +1014,7 @@ verify_charstarts (w)
    cancel the columns of that window, so that when the window is
    displayed over again get_display_line will not complain.  */
 
+void
 cancel_my_columns (w)
      struct window *w;
 {
@@ -1093,7 +1108,7 @@ direct_output_for_insert (g)
   unchanged_modified = MODIFF;
   beg_unchanged = GPT - BEG;
   XSETFASTINT (w->last_point, PT);
-  XSETFASTINT (w->last_point_x, hpos);
+  XSETFASTINT (w->last_point_x, hpos + 1);
   XSETFASTINT (w->last_modified, MODIFF);
   XSETFASTINT (w->last_overlay_modified, OVERLAY_MODIFF);
 
@@ -1117,14 +1132,12 @@ direct_output_forward_char (n)
   register FRAME_PTR frame = selected_frame;
   register struct window *w = XWINDOW (selected_window);
   Lisp_Object position;
-  /* This check is redundant.  It's checked at "losing cursor" below.  */
-#if 0
   int hpos = FRAME_CURSOR_X (frame);
 
   /* Give up if in truncated text at end of line.  */
+  /* This check is not redundant.  */
   if (hpos >= WINDOW_LEFT_MARGIN (w) + window_internal_width (w) - 1)
     return 0;
-#endif /* 0 */
 
   /* Give up if the buffer's direction is reversed (i.e. right-to-left).  */
   if (!NILP (XBUFFER(w->buffer)->direction_reversed))
@@ -1197,7 +1210,7 @@ update_frame (f, force, inhibit_hairy_id)
   register int i;
   int pause;
   int preempt_count = baud_rate / 2400 + 1;
-  extern input_pending;
+  extern int input_pending;
 #ifdef HAVE_WINDOW_SYSTEM
   register int downto, leftmost;
 #endif
@@ -1346,11 +1359,18 @@ update_frame (f, force, inhibit_hairy_id)
                }
              while (row > top && col == 0);
 
-             if (col >= FRAME_WINDOW_WIDTH (f))
+             /* Make sure COL is not out of range.  */
+             if (col >= FRAME_CURSOR_X_LIMIT (f))
                {
-                 col = 0;
+                 /* If we have another row, advance cursor into it.  */
                  if (row < FRAME_HEIGHT (f) - 1)
-                   row++;
+                   {
+                     col = FRAME_LEFT_SCROLL_BAR_WIDTH (f);
+                     row++;
+                   }
+                 /* Otherwise move it back in range.  */
+                 else
+                   col = FRAME_CURSOR_X_LIMIT (f) - 1;
                }
            }
 
@@ -1358,8 +1378,8 @@ update_frame (f, force, inhibit_hairy_id)
        }
       else
        cursor_to (FRAME_CURSOR_Y (f), 
-                  max (min (FRAME_CURSOR_X (f),
-                            FRAME_WINDOW_WIDTH (f) - 1), 0));
+                  minmax (0, FRAME_CURSOR_X (f),
+                          FRAME_CURSOR_X_LIMIT (f) - 1));
     }
 
   update_end (f);
@@ -1398,6 +1418,7 @@ quit_error_check ()
 
 extern void scrolling_1 ();
 
+int
 scrolling (frame)
      FRAME_PTR frame;
 {
@@ -1831,7 +1852,7 @@ update_line (frame, vpos)
          olen = nlen - (nsp - osp);
        }
       cursor_to (vpos, osp);
-      insert_glyphs ((char *)0, nsp - osp);
+      insert_glyphs ((GLYPH *) 0, nsp - osp);
     }
   olen += nsp - osp;
 
@@ -2070,6 +2091,7 @@ window_change_signal (signalnum) /* If we don't have an argument, */
 
 /* Do any change in frame size that was requested by a signal.  */
 
+void
 do_pending_window_change ()
 {
   /* If window_change_signal should have run before, run it now.  */
@@ -2101,9 +2123,10 @@ do_pending_window_change ()
    redisplay.  Since this tries to resize windows, we can't call it
    from a signal handler.  */
 
+void
 change_frame_size (f, newheight, newwidth, pretend, delay)
      register FRAME_PTR f;
-     int newheight, newwidth, pretend;
+     int newheight, newwidth, pretend, delay;
 {
   Lisp_Object tail, frame;
 
@@ -2127,6 +2150,7 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay)
 {
   int new_frame_window_width;
   unsigned int total_glyphs;
+  int count = specpdl_ptr - specpdl;
 
   /* If we can't deal with the change now, queue it for later.  */
   if (delay)
@@ -2223,8 +2247,8 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay)
   FRAME_HEIGHT (frame) = newheight;
   SET_FRAME_WIDTH (frame, newwidth);
 
-  if (FRAME_CURSOR_X (frame) >= FRAME_WINDOW_WIDTH (frame))
-    FRAME_CURSOR_X (frame) = FRAME_WINDOW_WIDTH (frame) - 1;
+  if (FRAME_CURSOR_X (frame) >= FRAME_CURSOR_X_LIMIT (frame))
+    FRAME_CURSOR_X (frame) = FRAME_CURSOR_X_LIMIT (frame) - 1;
   if (FRAME_CURSOR_Y (frame) >= FRAME_HEIGHT (frame))
     FRAME_CURSOR_Y (frame) = FRAME_HEIGHT (frame) - 1;
 
@@ -2233,9 +2257,13 @@ change_frame_size_1 (frame, newheight, newwidth, pretend, delay)
 
   UNBLOCK_INPUT;
 
+  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+
   /* This isn't quite a no-op: it runs window-configuration-change-hook.  */
   Fset_window_buffer (FRAME_SELECTED_WINDOW (frame),
                      XWINDOW (FRAME_SELECTED_WINDOW (frame))->buffer);
+
+  unbind_to (count, Qnil);
 }
 \f
 DEFUN ("send-string-to-terminal", Fsend_string_to_terminal,
@@ -2245,12 +2273,14 @@ Control characters in STRING will have terminal-dependent effects.")
   (string)
      Lisp_Object string;
 {
+  /* ??? Perhaps we should do something special for multibyte strings here.  */
   CHECK_STRING (string, 0);
-  fwrite (XSTRING (string)->data, 1, XSTRING (string)->size, stdout);
+  fwrite (XSTRING (string)->data, 1, STRING_BYTES (XSTRING (string)), stdout);
   fflush (stdout);
   if (termscript)
     {
-      fwrite (XSTRING (string)->data, 1, XSTRING (string)->size, termscript);
+      fwrite (XSTRING (string)->data, 1, STRING_BYTES (XSTRING (string)),
+             termscript);
       fflush (termscript);
     }
   return Qnil;
@@ -2277,6 +2307,7 @@ terminate any keyboard macro currently executing.")
   return Qnil;
 }
 
+void
 bitch_at_user ()
 {
   if (noninteractive)
@@ -2462,6 +2493,7 @@ char *terminal_type;
 /* Then invoke its decoding routine to set up variables
   in the terminal package */
 
+void
 init_display ()
 {
 #ifdef HAVE_X_WINDOWS
@@ -2498,7 +2530,11 @@ init_display ()
       display_arg = (display != 0 && *display != 0);
     }
 
-  if (!inhibit_window_system && display_arg && initialized)
+  if (!inhibit_window_system && display_arg 
+#ifndef CANNOT_DUMP
+     && initialized
+#endif
+     )
     {
       Vwindow_system = intern ("x");
 #ifdef HAVE_X11
@@ -2593,6 +2629,7 @@ For types not defined in VMS, use  define emacs_term \"TYPE\".\n\
 #endif /* SIGWINCH */
 }
 \f
+void
 syms_of_display ()
 {
   defsubr (&Sredraw_frame);