]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fset_window_hscroll, Fpos_visible_in_window_p):
authorKim F. Storm <storm@cua.dk>
Tue, 19 Sep 2006 13:12:26 +0000 (13:12 +0000)
committerKim F. Storm <storm@cua.dk>
Tue, 19 Sep 2006 13:12:26 +0000 (13:12 +0000)
Doc fix.  Use "off-screen" instead of "invisible".
(Fwindow_line_height): Make line numbers 0-based.  Make line arg
optional; if nil, use current cursor row.  Handle text terminals
properly.  Return nil if non-interactive or pseudo-window.

lisp/ChangeLog
src/window.c

index 2fbf08894a64887c9fdda1f82f19cccb11f93a11..724a6841bb70401c1b4ab094605c26903f8a0258 100644 (file)
@@ -1,15 +1,20 @@
+2006-09-19  Kim F. Storm  <storm@cua.dk>
+
+       * simple.el (line-move-partial): Optimize.  Try window-line-height
+       before posn-at-point to get vpos of current line.
+
 2006-09-18  Michael Kifer  <kifer@cs.stonybrook.edu>
-       
+
        * viper.el: Bumped up version/date of update to reflect the substantial
        changes done in August 2006.
-       
+
        * viper-cmd (viper-next-line-at-bol): make sure button-at, push-button
        are defined.
-       
+
        * ediff-util.el (ediff-add-to-history): new function.
-       
+
        * ediff.el: use ediff-add-to-history instead of add-to-history.
-       
+
 2006-09-18  Wolfgang Jenkner  <wjenkner@inode.at>  (tiny change)
 
        * textmodes/conf-mode.el (conf-space-mode): Doc fix.
index 69307449968b28d5e6439eacbba46b3390cb3869..adb384b72e5251f84ba54a504820c8c7f2a09f15 100644 (file)
@@ -340,8 +340,8 @@ return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
 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 @@ row, and VPOS is the row number (0-based) containing POS.  */)
 }
 
 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 @@ Return nil if window display is not up-to-date.  In that case, use
   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 @@ Return nil if window display is not up-to-date.  In that case, use
       || 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 @@ Return nil if window display is not up-to-date.  In that case, use
     }
 
   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 @@ Return nil if window display is not up-to-date.  In that case, use
   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 @@ DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
 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;
 {