diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2fbf08894a6..724a6841bb7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,15 +1,20 @@ +2006-09-19 Kim F. Storm + + * 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 - + * 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 (tiny change) * textmodes/conf-mode.el (conf-space-mode): Doc fix. diff --git a/src/window.c b/src/window.c index 69307449968..adb384b72e5 100644 --- a/src/window.c +++ b/src/window.c @@ -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; {