summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1993-01-14 15:10:14 +0000
committerJim Blandy <jimb@redhat.com>1993-01-14 15:10:14 +0000
commitfa61c7012f7c49b718341e92cdd864b184c5693d (patch)
treeffacad6a6346a64b56af6ac1c9508dbc9f7b55a3
parent20a6c8d708ed56e3cbaa0cba2f56d7ae446ae6a5 (diff)
downloademacs-fa61c7012f7c49b718341e92cdd864b184c5693d.tar.gz
emacs-fa61c7012f7c49b718341e92cdd864b184c5693d.tar.bz2
emacs-fa61c7012f7c49b718341e92cdd864b184c5693d.zip
* 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.
-rw-r--r--src/dispnew.c21
-rw-r--r--src/indent.c24
2 files changed, 22 insertions, 23 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 61337b3459a..7c9472e6c8c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -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 @@ direct_output_for_insert (g)
#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 @@ direct_output_forward_char (n)
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 @@ buffer_posn_from_coords (window, col, line)
/* 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);
diff --git a/src/indent.c b/src/indent.c
index d80ddd3891f..bcb3fe6169a 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -396,15 +396,23 @@ struct position val_compute_motion;
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 @@ pos_tab_offset (w, pos)
{
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 @@ Returns number of lines moved; may be closer to zero than LINES\n\
{
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);