Commit fa61c701 authored by Jim Blandy's avatar Jim Blandy

* 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.
parent 20a6c8d7
/* 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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment