diff options
| author | Kim F. Storm | 2006-09-19 13:12:26 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-09-19 13:12:26 +0000 |
| commit | 7bbc67d20f0cb892bc2a200f9a3ae3cd79b4ccd2 (patch) | |
| tree | be094cfed7aa8927598916fc72d210a3387227c3 | |
| parent | 08e26e8bfa6ea900b9f213506ec1d053f7e629f4 (diff) | |
| download | emacs-7bbc67d20f0cb892bc2a200f9a3ae3cd79b4ccd2.tar.gz emacs-7bbc67d20f0cb892bc2a200f9a3ae3cd79b4ccd2.zip | |
(Fset_window_hscroll, Fpos_visible_in_window_p):
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.
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | src/window.c | 58 |
2 files changed, 39 insertions, 34 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2fbf08894a6..724a6841bb7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,15 +1,20 @@ | |||
| 1 | 2006-09-19 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * simple.el (line-move-partial): Optimize. Try window-line-height | ||
| 4 | before posn-at-point to get vpos of current line. | ||
| 5 | |||
| 1 | 2006-09-18 Michael Kifer <kifer@cs.stonybrook.edu> | 6 | 2006-09-18 Michael Kifer <kifer@cs.stonybrook.edu> |
| 2 | 7 | ||
| 3 | * viper.el: Bumped up version/date of update to reflect the substantial | 8 | * viper.el: Bumped up version/date of update to reflect the substantial |
| 4 | changes done in August 2006. | 9 | changes done in August 2006. |
| 5 | 10 | ||
| 6 | * viper-cmd (viper-next-line-at-bol): make sure button-at, push-button | 11 | * viper-cmd (viper-next-line-at-bol): make sure button-at, push-button |
| 7 | are defined. | 12 | are defined. |
| 8 | 13 | ||
| 9 | * ediff-util.el (ediff-add-to-history): new function. | 14 | * ediff-util.el (ediff-add-to-history): new function. |
| 10 | 15 | ||
| 11 | * ediff.el: use ediff-add-to-history instead of add-to-history. | 16 | * ediff.el: use ediff-add-to-history instead of add-to-history. |
| 12 | 17 | ||
| 13 | 2006-09-18 Wolfgang Jenkner <wjenkner@inode.at> (tiny change) | 18 | 2006-09-18 Wolfgang Jenkner <wjenkner@inode.at> (tiny change) |
| 14 | 19 | ||
| 15 | * textmodes/conf-mode.el (conf-space-mode): Doc fix. | 20 | * 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]), | |||
| 340 | where X and Y are the pixel coordinates relative to the top left corner | 340 | where X and Y are the pixel coordinates relative to the top left corner |
| 341 | of the window. The remaining elements are omitted if the character after | 341 | of the window. The remaining elements are omitted if the character after |
| 342 | POS is fully visible; otherwise, RTOP and RBOT are the number of pixels | 342 | POS is fully visible; otherwise, RTOP and RBOT are the number of pixels |
| 343 | invisible at the top and bottom of the row, ROWH is the height of the display | 343 | off-screen at the top and bottom of the row, ROWH is the height of the |
| 344 | row, and VPOS is the row number (0-based) containing POS. */) | 344 | display row, and VPOS is the row number (0-based) containing POS. */) |
| 345 | (pos, window, partially) | 345 | (pos, window, partially) |
| 346 | Lisp_Object pos, window, partially; | 346 | Lisp_Object pos, window, partially; |
| 347 | { | 347 | { |
| @@ -391,19 +391,20 @@ row, and VPOS is the row number (0-based) containing POS. */) | |||
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | DEFUN ("window-line-height", Fwindow_line_height, | 393 | DEFUN ("window-line-height", Fwindow_line_height, |
| 394 | Swindow_line_height, 1, 2, 0, | 394 | Swindow_line_height, 0, 2, 0, |
| 395 | doc: /* Return height in pixels of text line LINE in window WINDOW. | 395 | doc: /* Return height in pixels of text line LINE in window WINDOW. |
| 396 | If WINDOW is nil or omitted, use selected window. | 396 | If WINDOW is nil or omitted, use selected window. |
| 397 | 397 | ||
| 398 | Normal text lines are numbered starting from 1. Negative numbers | 398 | Return height of current line if LINE is omitted or nil. Return height of |
| 399 | counts from the end of the window. Return height of header or mode | 399 | header or mode line if LINE is `header-line' and `mode-line'. |
| 400 | line if LINE is `header-line' and `mode-line'. | 400 | Otherwise, LINE is a text line number starting from 0. A negative number |
| 401 | counts from the end of the window. | ||
| 401 | 402 | ||
| 402 | Value is a list (HEIGHT VPOS YPOS INVIS), where HEIGHT is the height | 403 | Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height |
| 403 | in pixels of the visible part of the line, VPOS and YPOS are the | 404 | in pixels of the visible part of the line, VPOS and YPOS are the |
| 404 | vertical position in lines and pixels of the row, relative to the top | 405 | vertical position in lines and pixels of the row, relative to the top |
| 405 | of the first text line, and INVIS is the number of invisible pixels at | 406 | of the first text line, and OFFBOT is the number of off-screen pixels at |
| 406 | the bottom of the text row. If there are invisible pixels at the top | 407 | the bottom of the text row. If there are off-screen pixels at the top |
| 407 | of the (first) text row, YPOS is negative. | 408 | of the (first) text row, YPOS is negative. |
| 408 | 409 | ||
| 409 | Return nil if window display is not up-to-date. In that case, use | 410 | 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 | |||
| 419 | w = decode_window (window); | 420 | w = decode_window (window); |
| 420 | 421 | ||
| 421 | if (noninteractive | 422 | if (noninteractive |
| 422 | || !FRAME_WINDOW_P (WINDOW_XFRAME (w)) | ||
| 423 | || w->pseudo_window_p) | 423 | || w->pseudo_window_p) |
| 424 | { | 424 | return Qnil; |
| 425 | int vpos = (!INTEGERP (line) | ||
| 426 | ? 0 | ||
| 427 | : (n = XINT (line), n > 0) | ||
| 428 | ? (n - 1) | ||
| 429 | : (WINDOW_TOTAL_LINES (w) + n)); | ||
| 430 | return list4 (make_number (1), /* fixed line height */ | ||
| 431 | make_number(vpos), make_number (vpos), | ||
| 432 | make_number (0)); | ||
| 433 | } | ||
| 434 | 425 | ||
| 435 | CHECK_BUFFER (w->buffer); | 426 | CHECK_BUFFER (w->buffer); |
| 436 | b = XBUFFER (w->buffer); | 427 | b = XBUFFER (w->buffer); |
| @@ -443,6 +434,16 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 443 | || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) | 434 | || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) |
| 444 | return Qnil; | 435 | return Qnil; |
| 445 | 436 | ||
| 437 | if (NILP (line)) | ||
| 438 | { | ||
| 439 | i = w->cursor.vpos; | ||
| 440 | if (i < 0 || i >= w->current_matrix->nrows | ||
| 441 | || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p)) | ||
| 442 | return Qnil; | ||
| 443 | max_y = window_text_bottom_y (w); | ||
| 444 | goto found_row; | ||
| 445 | } | ||
| 446 | |||
| 446 | if (EQ (line, Qheader_line)) | 447 | if (EQ (line, Qheader_line)) |
| 447 | { | 448 | { |
| 448 | if (!WINDOW_WANTS_HEADER_LINE_P (w)) | 449 | 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 | |||
| 468 | } | 469 | } |
| 469 | 470 | ||
| 470 | CHECK_NUMBER (line); | 471 | CHECK_NUMBER (line); |
| 471 | 472 | n = XINT (line); | |
| 472 | if ((n = XINT (line), !n)) | ||
| 473 | return Qnil; | ||
| 474 | 473 | ||
| 475 | row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 474 | row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
| 476 | end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); | 475 | end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); |
| 477 | max_y = window_text_bottom_y (w); | 476 | max_y = window_text_bottom_y (w); |
| 478 | i = 1; | 477 | i = 0; |
| 479 | 478 | ||
| 480 | while ((n < 0 || i < n) | 479 | while ((n < 0 || i < n) |
| 481 | && row <= end_row && row->enabled_p | 480 | && row <= end_row && row->enabled_p |
| @@ -485,17 +484,18 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 485 | if (row > end_row || !row->enabled_p) | 484 | if (row > end_row || !row->enabled_p) |
| 486 | return Qnil; | 485 | return Qnil; |
| 487 | 486 | ||
| 488 | if (n < 0) | 487 | if (++n < 0) |
| 489 | { | 488 | { |
| 490 | if (-n > i) | 489 | if (-n > i) |
| 491 | return Qnil; | 490 | return Qnil; |
| 492 | row += n + 1; | 491 | row += n; |
| 493 | i += n + 1; | 492 | i += n; |
| 494 | } | 493 | } |
| 495 | 494 | ||
| 495 | found_row: | ||
| 496 | crop = max (0, (row->y + row->height) - max_y); | 496 | crop = max (0, (row->y + row->height) - max_y); |
| 497 | return list4 (make_number (row->height + min (0, row->y) - crop), | 497 | return list4 (make_number (row->height + min (0, row->y) - crop), |
| 498 | make_number (i - 1), | 498 | make_number (i), |
| 499 | make_number (row->y), | 499 | make_number (row->y), |
| 500 | make_number (crop)); | 500 | make_number (crop)); |
| 501 | } | 501 | } |
| @@ -565,7 +565,7 @@ DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | |||
| 565 | Return NCOL. NCOL should be zero or positive. | 565 | Return NCOL. NCOL should be zero or positive. |
| 566 | 566 | ||
| 567 | Note that if `automatic-hscrolling' is non-nil, you cannot scroll the | 567 | Note that if `automatic-hscrolling' is non-nil, you cannot scroll the |
| 568 | window so that the location of point becomes invisible. */) | 568 | window so that the location of point moves off-screen. */) |
| 569 | (window, ncol) | 569 | (window, ncol) |
| 570 | Lisp_Object window, ncol; | 570 | Lisp_Object window, ncol; |
| 571 | { | 571 | { |