emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/window.c,v


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/src/window.c,v
Date: Tue, 19 Sep 2006 13:09:11 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kim F. Storm <kfstorm>  06/09/19 13:09:11

Index: window.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/window.c,v
retrieving revision 1.559
retrieving revision 1.560
diff -u -b -r1.559 -r1.560
--- window.c    18 Sep 2006 11:11:23 -0000      1.559
+++ window.c    19 Sep 2006 13:09:11 -0000      1.560
@@ -340,8 +340,8 @@
 where X and Y are the pixel coordinates relative to the top left corner
 of the window.  The remaining elements are omitted if the character after
 POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
-invisible at the top and bottom of the row, ROWH is the height of the display
-row, and VPOS is the row number (0-based) containing POS.  */)
+off-screen at the top and bottom of the row, ROWH is the height of the
+display row, and VPOS is the row number (0-based) containing POS.  */)
      (pos, window, partially)
      Lisp_Object pos, window, partially;
 {
@@ -391,19 +391,20 @@
 }
 
 DEFUN ("window-line-height", Fwindow_line_height,
-       Swindow_line_height, 1, 2, 0,
+       Swindow_line_height, 0, 2, 0,
        doc: /* Return height in pixels of text line LINE in window WINDOW.
 If WINDOW is nil or omitted, use selected window.
 
-Normal text lines are numbered starting from 1.  Negative numbers
-counts from the end of the window.  Return height of header or mode
-line if LINE is `header-line' and `mode-line'.
+Return height of current line if LINE is omitted or nil.  Return height of
+header or mode line if LINE is `header-line' and `mode-line'.
+Otherwise, LINE is a text line number starting from 0.  A negative number
+counts from the end of the window.
 
-Value is a list (HEIGHT VPOS YPOS INVIS), where HEIGHT is the height
+Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height
 in pixels of the visible part of the line, VPOS and YPOS are the
 vertical position in lines and pixels of the row, relative to the top
-of the first text line, and INVIS is the number of invisible pixels at
-the bottom of the text row.  If there are invisible pixels at the top
+of the first text line, and OFFBOT is the number of off-screen pixels at
+the bottom of the text row.  If there are off-screen pixels at the top
 of the (first) text row, YPOS is negative.
 
 Return nil if window display is not up-to-date.  In that case, use
@@ -419,18 +420,8 @@
   w = decode_window (window);
 
   if (noninteractive
-      || !FRAME_WINDOW_P (WINDOW_XFRAME (w))
       || w->pseudo_window_p)
-    {
-      int vpos = (!INTEGERP (line)
-                 ? 0
-                 : (n = XINT (line), n > 0)
-                 ? (n - 1)
-                 : (WINDOW_TOTAL_LINES (w) + n));
-      return list4 (make_number (1), /* fixed line height */
-                   make_number(vpos), make_number (vpos),
-                   make_number (0));
-    }
+    return Qnil;
 
   CHECK_BUFFER (w->buffer);
   b = XBUFFER (w->buffer);
@@ -443,6 +434,16 @@
       || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b))
     return Qnil;
 
+  if (NILP (line))
+    {
+      i = w->cursor.vpos;
+      if (i < 0 || i >= w->current_matrix->nrows
+         || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p))
+       return Qnil;
+      max_y = window_text_bottom_y (w);
+      goto found_row;
+    }
+
   if (EQ (line, Qheader_line))
     {
       if (!WINDOW_WANTS_HEADER_LINE_P (w))
@@ -468,14 +469,12 @@
     }
 
   CHECK_NUMBER (line);
-
-  if ((n = XINT (line), !n))
-    return Qnil;
+  n = XINT (line);
 
   row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
   end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);
   max_y = window_text_bottom_y (w);
-  i = 1;
+  i = 0;
 
   while ((n < 0 || i < n)
         && row <= end_row && row->enabled_p
@@ -485,17 +484,18 @@
   if (row > end_row || !row->enabled_p)
     return Qnil;
 
-  if (n < 0)
+  if (++n < 0)
     {
       if (-n > i)
        return Qnil;
-      row += n + 1;
-      i += n + 1;
+      row += n;
+      i += n;
     }
 
+ found_row:
   crop = max (0, (row->y + row->height) - max_y);
   return list4 (make_number (row->height + min (0, row->y) - crop),
-               make_number (i - 1),
+               make_number (i),
                make_number (row->y),
                make_number (crop));
 }
@@ -565,7 +565,7 @@
 Return NCOL.  NCOL should be zero or positive.
 
 Note that if `automatic-hscrolling' is non-nil, you cannot scroll the
-window so that the location of point becomes invisible.  */)
+window so that the location of point moves off-screen.  */)
      (window, ncol)
      Lisp_Object window, ncol;
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]