aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy1993-01-14 15:10:14 +0000
committerJim Blandy1993-01-14 15:10:14 +0000
commitfa61c7012f7c49b718341e92cdd864b184c5693d (patch)
treeffacad6a6346a64b56af6ac1c9508dbc9f7b55a3 /src
parent20a6c8d708ed56e3cbaa0cba2f56d7ae446ae6a5 (diff)
downloademacs-fa61c7012f7c49b718341e92cdd864b184c5693d.tar.gz
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.
Diffstat (limited to 'src')
-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 @@
1/* Updating of data structures for redisplay. 1/* Updating of data structures for redisplay.
2 Copyright (C) 1985, 1986, 1987, 1988, 1990, 2 Copyright (C) 1985, 1986, 1987, 1988, 1990,
3 1992 Free Software Foundation, Inc. 3 1992, 1993 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
7GNU Emacs is free software; you can redistribute it and/or modify 7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by 8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 1, or (at your option) 9the Free Software Foundation; either version 2, or (at your option)
10any later version. 10any later version.
11 11
12GNU Emacs is distributed in the hope that it will be useful, 12GNU Emacs is distributed in the hope that it will be useful,
@@ -828,9 +828,9 @@ direct_output_for_insert (g)
828#endif /* COMPILER_REGISTER_BUG */ 828#endif /* COMPILER_REGISTER_BUG */
829 int vpos = FRAME_CURSOR_Y (frame); 829 int vpos = FRAME_CURSOR_Y (frame);
830 830
831 /* Give up if about to continue line */ 831 /* Give up if about to continue line. */
832 if (hpos - XFASTINT (w->left) + 1 + 1 >= XFASTINT (w->width) 832 if (hpos >= XFASTINT (w->left) + window_internal_width (w) - 1
833 833
834 /* Avoid losing if cursor is in invisible text off left margin */ 834 /* Avoid losing if cursor is in invisible text off left margin */
835 || (XINT (w->hscroll) && hpos == XFASTINT (w->left)) 835 || (XINT (w->hscroll) && hpos == XFASTINT (w->left))
836 836
@@ -881,10 +881,7 @@ direct_output_forward_char (n)
881 if ((FRAME_CURSOR_X (frame) == XFASTINT (w->left) 881 if ((FRAME_CURSOR_X (frame) == XFASTINT (w->left)
882 && (XINT (w->hscroll) || n < 0)) 882 && (XINT (w->hscroll) || n < 0))
883 || (n > 0 883 || (n > 0
884 && (FRAME_CURSOR_X (frame) + 1 884 && (FRAME_CURSOR_X (frame) + 1 >= window_internal_width (w) - 1))
885 >= (XFASTINT (w->left) + XFASTINT (w->width)
886 - (XFASTINT (w->width) < FRAME_WIDTH (frame))
887 - 1)))
888 || cursor_in_echo_area) 885 || cursor_in_echo_area)
889 return 0; 886 return 0;
890 887
@@ -1176,9 +1173,7 @@ buffer_posn_from_coords (window, col, line)
1176 /* The actual width of the window is window->width less one for the 1173 /* The actual width of the window is window->width less one for the
1177 DISP_CONTINUE_GLYPH, and less one if it's not the rightmost 1174 DISP_CONTINUE_GLYPH, and less one if it's not the rightmost
1178 window. */ 1175 window. */
1179 int window_width = (XFASTINT (window->width) - 1 1176 int window_width = window_internal_width (window) - 1;
1180 - (XFASTINT (window->width) + window_left
1181 != FRAME_WIDTH (XFRAME (window->frame))));
1182 1177
1183 int startp = marker_position (window->start); 1178 int startp = marker_position (window->start);
1184 1179
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;
396 When displaying in window w, a typical formula for WIDTH is: 396 When displaying in window w, a typical formula for WIDTH is:
397 397
398 window_width - 1 398 window_width - 1
399 - (window_width + window_left != frame_width) 399 - (has_vertical_scrollbars
400 ? VERTICAL_SCROLLBAR_WIDTH
401 : (window_width + window_left != frame_width))
400 402
401 where 403 where
402 window_width is XFASTINT (w->width), 404 window_width is XFASTINT (w->width),
403 window_left is XFASTINT (w->left), 405 window_left is XFASTINT (w->left),
404 and frame_width = FRAME_WIDTH (XFRAME (window->frame)) 406 has_vertical_scrollbars is
407 FRAME_HAS_VERTICAL_SCROLLBARS (XFRAME (WINDOW_FRAME (window)))
408 and frame_width = FRAME_WIDTH (XFRAME (window->frame))
405 409
406 This accounts for the continuation-line backslashes, and the window 410 Or,
407 borders if the window is split vertically. */ 411 window_internal_width (w) - 1
412
413 The `-1' accounts for the continuation-line backslashes; the rest
414 accounts for window borders if the window is split vertically, and
415 the scrollbars if the frame supports them. */
408 416
409struct position * 417struct position *
410compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, tab_offset) 418compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, tab_offset)
@@ -560,9 +568,7 @@ pos_tab_offset (w, pos)
560{ 568{
561 int opoint = point; 569 int opoint = point;
562 int col; 570 int col;
563 int width = XFASTINT (w->width) - 1 571 int width = window_internal_width (w) - 1;
564 - (XFASTINT (w->width) + XFASTINT (w->left)
565 != FRAME_WIDTH (XFRAME (w->frame)));
566 572
567 if (pos == BEGV || FETCH_CHAR (pos - 1) == '\n') 573 if (pos == BEGV || FETCH_CHAR (pos - 1) == '\n')
568 return 0; 574 return 0;
@@ -677,9 +683,7 @@ Returns number of lines moved; may be closer to zero than LINES\n\
677{ 683{
678 struct position pos; 684 struct position pos;
679 register struct window *w = XWINDOW (selected_window); 685 register struct window *w = XWINDOW (selected_window);
680 int width = XFASTINT (w->width) - 1 686 int width = window_internal_width (w) - 1;
681 - (XFASTINT (w->width) + XFASTINT (w->left)
682 != FRAME_WIDTH (XFRAME (w->frame)));
683 687
684 CHECK_NUMBER (lines, 0); 688 CHECK_NUMBER (lines, 0);
685 689