]> code.delx.au - gnu-emacs/commitdiff
(Frecenter): Use displayed_window_lines instead
authorGerd Moellmann <gerd@gnu.org>
Wed, 27 Dec 2000 15:46:54 +0000 (15:46 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 27 Dec 2000 15:46:54 +0000 (15:46 +0000)
of window_internal_height.

src/ChangeLog
src/window.c

index 4d162c46b9756ae6f140400389a2ae2cb75cce77..32cd8dee99198a93cfaae7134a13dcc973ae6a38 100644 (file)
@@ -1,5 +1,8 @@
 2000-12-27  Gerd Moellmann  <gerd@gnu.org>
 
+       * window.c (Frecenter): Use displayed_window_lines instead
+       of window_internal_height.
+
        * xterm.c (syms_of_xterm): DEFVAR_LISP x-toolkit-scroll-bars
        instead of x-toolkit-scroll-bars-p.
        (Vx_toolkit_scroll_bars): Renamed from x_toolkit_scroll_bars_p.
index f2af5e3305ac05665b7a15416cb48d96bbadc167..c148598ae62e186e44d074a8eb888940b42da52f 100644 (file)
@@ -4433,6 +4433,54 @@ Default for ARG is window width minus 2.")
                                      - XINT (arg)));
 }
 
+
+/* Value is the number of lines actually displayed in window W,
+   as opposed to its height.  */
+
+static int
+displayed_window_lines (w)
+     struct window *w;
+{
+  struct it it;
+  struct text_pos start;
+  int height = window_box_height (w);
+  struct buffer *old_buffer;
+  int bottom_y;
+
+  if (XBUFFER (w->buffer) != current_buffer)
+    {
+      old_buffer = current_buffer;
+      set_buffer_internal (XBUFFER (w->buffer));
+    }
+  else
+    old_buffer = NULL;
+
+  SET_TEXT_POS_FROM_MARKER (start, w->start);
+  start_display (&it, w, start);
+  move_it_vertically (&it, height);
+
+  if (old_buffer)
+    set_buffer_internal (old_buffer);
+
+  bottom_y = it.current_y + it.max_ascent + it.max_descent;
+
+  if (bottom_y > it.current_y && bottom_y <= it.last_visible_y)
+    /* Hit a line without a terminating newline.  */
+    it.vpos++;
+
+  /* Add in empty lines at the bottom of the window.  */
+  if (bottom_y < height)
+    {
+      struct frame *f = XFRAME (w->frame);
+      int rest = height - bottom_y;
+      int lines = rest / CANON_Y_UNIT (f);
+      it.vpos += lines;
+    }
+
+  return it.vpos;
+}
+
+
 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P",
   "Center point in window and redisplay frame.  With ARG, put point on line ARG.\n\
 The desired position of point is always relative to the current window.\n\
@@ -4443,7 +4491,7 @@ redraws with point in the center of the current window.")
      register Lisp_Object arg;
 {
   register struct window *w = XWINDOW (selected_window);
-  register int ht = window_internal_height (w);
+  register int ht = displayed_window_lines (w);
   struct position pos;
   struct buffer *buf = XBUFFER (w->buffer);
   struct buffer *obuf = current_buffer;
@@ -4488,53 +4536,6 @@ redraws with point in the center of the current window.")
 }
 
 
-/* Value is the number of lines actually displayed in window W,
-   as opposed to its height.  */
-
-static int
-displayed_window_lines (w)
-     struct window *w;
-{
-  struct it it;
-  struct text_pos start;
-  int height = window_box_height (w);
-  struct buffer *old_buffer;
-  int bottom_y;
-
-  if (XBUFFER (w->buffer) != current_buffer)
-    {
-      old_buffer = current_buffer;
-      set_buffer_internal (XBUFFER (w->buffer));
-    }
-  else
-    old_buffer = NULL;
-
-  SET_TEXT_POS_FROM_MARKER (start, w->start);
-  start_display (&it, w, start);
-  move_it_vertically (&it, height);
-
-  if (old_buffer)
-    set_buffer_internal (old_buffer);
-
-  bottom_y = it.current_y + it.max_ascent + it.max_descent;
-
-  if (bottom_y > it.current_y && bottom_y <= it.last_visible_y)
-    /* Hit a line without a terminating newline.  */
-    it.vpos++;
-
-  /* Add in empty lines at the bottom of the window.  */
-  if (bottom_y < height)
-    {
-      struct frame *f = XFRAME (w->frame);
-      int rest = height - bottom_y;
-      int lines = rest / CANON_Y_UNIT (f);
-      it.vpos += lines;
-    }
-
-  return it.vpos;
-}
-
-
 DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height,
   0, 1, 0,
   "Return the height in lines of the text display area of WINDOW.\n\