changeset 1708:a19b0eb5dfc1

[xemacs-hg @ 2003-09-22 04:21:42 by james] Add new pos-visible-in-window-p parameter for Emacs compatibility.
author james
date Mon, 22 Sep 2003 04:21:43 +0000
parents fca75a427ae3
children 2f1ad95e2378
files src/ChangeLog src/redisplay.c src/redisplay.h src/scrollbar.c src/window.c
diffstat 5 files changed, 31 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Sep 22 03:22:16 2003 +0000
+++ b/src/ChangeLog	Mon Sep 22 04:21:43 2003 +0000
@@ -1,3 +1,14 @@
+2003-09-09  Jerry James  <james@xemacs.org>
+
+	* redisplay.c (point_would_be_visible): Add PARTIALLY parameter to
+	support new Fpos_visible_in_window_p parameter.
+	* redisplay.h: Ditto.
+	* scrollbar.c (scrollbar_reset_cursor): Use new
+	point_would_be_visible parameter.
+	* window.c (Fpos_visible_in_window_p): Add PARTALLY parameter for
+	Emacs compatibility.
+	(window_scroll): Use new point_would_be_visible parameter.
+
 2003-09-21  Jerry James  <james@xemacs.org>
 
 	* device-x.c (x_init_device): dll_open now takes a Lisp_Object.
--- a/src/redisplay.c	Mon Sep 22 03:22:16 2003 +0000
+++ b/src/redisplay.c	Mon Sep 22 04:21:43 2003 +0000
@@ -8083,10 +8083,13 @@
 }
 
 /* Return a boolean indicating if POINT would be visible in window W
-   if display of the window was to begin at STARTP. */
-
+   if display of the window was to begin at STARTP.  If PARTIALLY is
+   zero, then if POINT has fewer visible pixels than the window clip,
+   0 is returned; otherwise, 1 is returned if POINT has any visible
+   pixels. */
 int
-point_would_be_visible (struct window *w, Charbpos startp, Charbpos point)
+point_would_be_visible (struct window *w, Charbpos startp, Charbpos point,
+			int partially)
 {
   struct buffer *b = XBUFFER (w->buffer);
   int pixpos = -WINDOW_TEXT_TOP_CLIP(w);
@@ -8145,7 +8148,7 @@
 
       if (pixpos + height > bottom)
 	{
-	  if (bottom - pixpos < VERTICAL_CLIP (w, 0))
+	  if (bottom - pixpos < (partially ? 0 : VERTICAL_CLIP (w, 0)))
 	    {
 	      w->line_cache_validation_override--;
 	      return 0;
--- a/src/redisplay.h	Mon Sep 22 03:22:16 2003 +0000
+++ b/src/redisplay.h	Mon Sep 22 04:21:43 2003 +0000
@@ -758,7 +758,7 @@
 int point_in_line_start_cache (struct window *w, Charbpos point,
 			       int min_past);
 int point_would_be_visible (struct window *w, Charbpos startp,
-			    Charbpos point);
+			    Charbpos point, int partially);
 Charbpos start_of_last_line (struct window *w, Charbpos startp);
 Charbpos end_of_last_line (struct window *w, Charbpos startp);
 Charbpos start_with_line_at_pixpos (struct window *w, Charbpos point,
--- a/src/scrollbar.c	Mon Sep 22 03:22:16 2003 +0000
+++ b/src/scrollbar.c	Mon Sep 22 04:21:43 2003 +0000
@@ -692,7 +692,7 @@
       else
 	Fset_window_point (win, make_int (start_pos));
     }
-  else if (!point_would_be_visible (XWINDOW (win), start_pos, ptint))
+  else if (!point_would_be_visible (XWINDOW (win), start_pos, ptint, 0))
     {
       Fmove_to_window_line (make_int (-1), win);
 
--- a/src/window.c	Mon Sep 22 03:22:16 2003 +0000
+++ b/src/window.c	Mon Sep 22 04:21:43 2003 +0000
@@ -1413,12 +1413,14 @@
   return window_is_rightmost (decode_window (window)) ? Qt : Qnil;
 }
 
-DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, 0, 2, 0, /*
-Return t if position POS is currently on the frame in WINDOW.
+DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, 0, 3, 0, /*
+Returns t if position POS is currently on the frame in WINDOW.
 Returns nil if that position is scrolled vertically out of view.
+If a character is only partially visible, nil is returned, unless the
+optional argument PARTIALLY is non-nil.
 POS defaults to point in WINDOW's buffer; WINDOW, to the selected window.
 */
-       (pos, window))
+       (pos, window, partially))
 {
   struct window *w = decode_window (window);
   Charbpos top = marker_position (w->start[CURRENT_DISP]);
@@ -1440,7 +1442,8 @@
   if (top < BUF_BEGV (buf) || top > BUF_ZV (buf))
     return Qnil;
 
-  return point_would_be_visible (w, top, posint) ? Qt : Qnil;
+  return point_would_be_visible (w, top, posint, !NILP (partially))
+    ? Qt : Qnil;
 }
 
 
@@ -4459,7 +4462,7 @@
   /* #### When the fuck does this happen?  I'm so glad that history has
      completely documented the behavior of the scrolling functions under
      all circumstances. */
-  tem = Fpos_visible_in_window_p (point, window);
+  tem = Fpos_visible_in_window_p (point, window, Qnil);
   if (NILP (tem))
     {
       Fvertical_motion (make_int (-window_char_height (w, 0) / 2),
@@ -4567,7 +4570,7 @@
 	      w->start_at_line_beg = beginning_of_line_p (b, startp);
 	      MARK_WINDOWS_CHANGED (w);
 
-	      if (!point_would_be_visible (w, startp, XINT (point)))
+	      if (!point_would_be_visible (w, startp, XINT (point), 0))
 		Fset_window_point (wrap_window (w), make_int (startp));
 	    }
 	}
@@ -4635,7 +4638,7 @@
 		  WINDOW_TEXT_TOP_CLIP (w) = (dl->ascent + fheight * value);
 		}
 
-	      if (!point_would_be_visible (w, startp, XINT (point)))
+	      if (!point_would_be_visible (w, startp, XINT (point), 0))
 		{
 		  Charbpos new_point;
 
@@ -4680,7 +4683,7 @@
 	  w->start_at_line_beg = beginning_of_line_p (b, startp);
 	  MARK_WINDOWS_CHANGED (w);
 
-	  if (!point_would_be_visible (w, startp, XINT (point)))
+	  if (!point_would_be_visible (w, startp, XINT (point), 0))
 	    {
 	      Charbpos new_point = start_of_last_line (w, startp);