changeset 1777:4edfaa19c7a7

* window.c (window_internal_width): New function. * lisp.h (window_internal_height, window_internal_width): Add extern declarations for these. * dispnew.c (direct_output_for_insert, direct_output_forward_char, buffer_posn_from_coords): Use window_internal_width instead of writing out its definition. * indent.c (compute_motion): Doc fix; mention scrollbars and window_internal_width. (pos_tab_offset, Fvertical_motion): Use window_internal_width instead of writing it out. * window.c (Fpos_visible_in_window_p, Fwindow_width, Fscroll_left, Fscroll_right): Same. * xdisp.c (redisplay, try_window, try_window_id, display_text_line): Same.
author Jim Blandy <jimb@redhat.com>
date Thu, 14 Jan 1993 15:10:14 +0000
parents 20c6f4aa5843
children 1f18bfe28e2f
files src/dispnew.c src/indent.c
diffstat 2 files changed, 22 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispnew.c	Thu Jan 14 15:09:51 1993 +0000
+++ b/src/dispnew.c	Thu Jan 14 15:10:14 1993 +0000
@@ -1,12 +1,12 @@
 /* Updating of data structures for redisplay.
-   Copyright (C) 1985, 1986, 1987, 1988, 1990,
-   1992 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1988, 1990, 
+   1992, 1993 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -828,9 +828,9 @@
 #endif /* COMPILER_REGISTER_BUG */
     int vpos = FRAME_CURSOR_Y (frame);
 
-  /* Give up if about to continue line */
-  if (hpos - XFASTINT (w->left) + 1 + 1 >= XFASTINT (w->width)
-
+  /* Give up if about to continue line.  */
+  if (hpos >= XFASTINT (w->left) + window_internal_width (w) - 1
+    
   /* Avoid losing if cursor is in invisible text off left margin */
       || (XINT (w->hscroll) && hpos == XFASTINT (w->left))
     
@@ -881,10 +881,7 @@
   if ((FRAME_CURSOR_X (frame) == XFASTINT (w->left)
        && (XINT (w->hscroll) || n < 0))
       || (n > 0
-	  && (FRAME_CURSOR_X (frame) + 1
-	      >= (XFASTINT (w->left) + XFASTINT (w->width)
-		  - (XFASTINT (w->width) < FRAME_WIDTH (frame))
-		  - 1)))
+	  && (FRAME_CURSOR_X (frame) + 1 >= window_internal_width (w) - 1))
       || cursor_in_echo_area)
     return 0;
 
@@ -1176,9 +1173,7 @@
   /* The actual width of the window is window->width less one for the
      DISP_CONTINUE_GLYPH, and less one if it's not the rightmost
      window.  */
-  int window_width = (XFASTINT (window->width) - 1
-		      - (XFASTINT (window->width) + window_left
-			 != FRAME_WIDTH (XFRAME (window->frame))));
+  int window_width = window_internal_width (window) - 1;
 
   int startp = marker_position (window->start);
 
--- a/src/indent.c	Thu Jan 14 15:09:51 1993 +0000
+++ b/src/indent.c	Thu Jan 14 15:10:14 1993 +0000
@@ -396,15 +396,23 @@
    When displaying in window w, a typical formula for WIDTH is:
 
 	window_width - 1
-	 - (window_width + window_left != frame_width)
+	 - (has_vertical_scrollbars
+	    ? VERTICAL_SCROLLBAR_WIDTH
+	    : (window_width + window_left != frame_width))
 
 	where
 	  window_width is XFASTINT (w->width),
 	  window_left is XFASTINT (w->left),
-	  and frame_width = FRAME_WIDTH (XFRAME (window->frame))    
+	  has_vertical_scrollbars is
+	    FRAME_HAS_VERTICAL_SCROLLBARS (XFRAME (WINDOW_FRAME (window)))
+	  and frame_width = FRAME_WIDTH (XFRAME (window->frame))
 
-   This accounts for the continuation-line backslashes, and the window
-   borders if the window is split vertically.  */
+	Or,
+	  window_internal_width (w) - 1
+
+   The `-1' accounts for the continuation-line backslashes; the rest
+   accounts for window borders if the window is split vertically, and
+   the scrollbars if the frame supports them.  */
 
 struct position *
 compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, tab_offset)
@@ -560,9 +568,7 @@
 {
   int opoint = point;
   int col;
-  int width = XFASTINT (w->width) - 1
-    - (XFASTINT (w->width) + XFASTINT (w->left)
-       != FRAME_WIDTH (XFRAME (w->frame)));
+  int width = window_internal_width (w) - 1;
 
   if (pos == BEGV || FETCH_CHAR (pos - 1) == '\n')
     return 0;
@@ -677,9 +683,7 @@
 {
   struct position pos;
   register struct window *w = XWINDOW (selected_window);
-  int width = XFASTINT (w->width) - 1
-    - (XFASTINT (w->width) + XFASTINT (w->left)
-       != FRAME_WIDTH (XFRAME (w->frame)));
+  int width = window_internal_width (w) - 1;
 
   CHECK_NUMBER (lines, 0);