diff options
| author | Eli Zaretskii | 2016-06-27 18:27:58 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2016-06-27 18:27:58 +0300 |
| commit | defdee72c4de5e1aa4fc5c63b81983afc969769a (patch) | |
| tree | a500f92aed9a3dda5b4d62ff06fc54792a943f47 | |
| parent | 8040d99b6294ad798d4ab677ba20082b45fd2e7d (diff) | |
| download | emacs-defdee72c4de5e1aa4fc5c63b81983afc969769a.tar.gz emacs-defdee72c4de5e1aa4fc5c63b81983afc969769a.zip | |
Fix 'move-to-window-line' when EOB is on last screen line
* src/window.c (displayed_window_lines): Fix an off-by-one error
when the bottom of the last display line is exactly at window's
last pixel. Remove kludgey fix for TTY frames that is no longer
needed. (Bug#15760)
(Fmove_to_window_line): Doc fix.
* doc/lispref/positions.texi (Screen Lines): Clarify and make more
accurate the documentation of 'move-to-window-line'.
| -rw-r--r-- | doc/lispref/positions.texi | 14 | ||||
| -rw-r--r-- | src/window.c | 18 |
2 files changed, 16 insertions, 16 deletions
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index 1d748b87529..796a06615ae 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi | |||
| @@ -590,10 +590,12 @@ any buffer, whether or not it is currently displayed in some window. | |||
| 590 | @deffn Command move-to-window-line count | 590 | @deffn Command move-to-window-line count |
| 591 | This function moves point with respect to the text currently displayed | 591 | This function moves point with respect to the text currently displayed |
| 592 | in the selected window. It moves point to the beginning of the screen | 592 | in the selected window. It moves point to the beginning of the screen |
| 593 | line @var{count} screen lines from the top of the window. If | 593 | line @var{count} screen lines from the top of the window; zero means |
| 594 | @var{count} is negative, that specifies a position | 594 | the topmost line. If @var{count} is negative, that specifies a |
| 595 | @w{@minus{}@var{count}} lines from the bottom (or the last line of the | 595 | position @w{@minus{}@var{count}} lines from the bottom (or the last |
| 596 | buffer, if the buffer ends above the specified screen position). | 596 | line of the buffer, if the buffer ends above the specified screen |
| 597 | position); thus, @var{count} of -1 specifies the last fully visible | ||
| 598 | screen line of the window. | ||
| 597 | 599 | ||
| 598 | If @var{count} is @code{nil}, then point moves to the beginning of the | 600 | If @var{count} is @code{nil}, then point moves to the beginning of the |
| 599 | line in the middle of the window. If the absolute value of @var{count} | 601 | line in the middle of the window. If the absolute value of @var{count} |
| @@ -604,8 +606,8 @@ location onto the screen. | |||
| 604 | 606 | ||
| 605 | In an interactive call, @var{count} is the numeric prefix argument. | 607 | In an interactive call, @var{count} is the numeric prefix argument. |
| 606 | 608 | ||
| 607 | The value returned is the window line number point has moved to, with | 609 | The value returned is the screen line number point has moved to, |
| 608 | the top line in the window numbered 0. | 610 | relative to the top line of the window. |
| 609 | @end deffn | 611 | @end deffn |
| 610 | 612 | ||
| 611 | @vindex move-to-window-group-line-function | 613 | @vindex move-to-window-group-line-function |
diff --git a/src/window.c b/src/window.c index fe10241c45c..e123b89aae3 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -5651,21 +5651,14 @@ displayed_window_lines (struct window *w) | |||
| 5651 | bottom_y = line_bottom_y (&it); | 5651 | bottom_y = line_bottom_y (&it); |
| 5652 | bidi_unshelve_cache (itdata, false); | 5652 | bidi_unshelve_cache (itdata, false); |
| 5653 | 5653 | ||
| 5654 | /* rms: On a non-window display, | ||
| 5655 | the value of it.vpos at the bottom of the screen | ||
| 5656 | seems to be 1 larger than window_box_height (w). | ||
| 5657 | This kludge fixes a bug whereby (move-to-window-line -1) | ||
| 5658 | when ZV is on the last screen line | ||
| 5659 | moves to the previous screen line instead of the last one. */ | ||
| 5660 | if (! FRAME_WINDOW_P (XFRAME (w->frame))) | ||
| 5661 | height++; | ||
| 5662 | |||
| 5663 | /* Add in empty lines at the bottom of the window. */ | 5654 | /* Add in empty lines at the bottom of the window. */ |
| 5664 | if (bottom_y < height) | 5655 | if (bottom_y < height) |
| 5665 | { | 5656 | { |
| 5666 | int uy = FRAME_LINE_HEIGHT (it.f); | 5657 | int uy = FRAME_LINE_HEIGHT (it.f); |
| 5667 | it.vpos += (height - bottom_y + uy - 1) / uy; | 5658 | it.vpos += (height - bottom_y + uy - 1) / uy; |
| 5668 | } | 5659 | } |
| 5660 | else if (bottom_y == height) | ||
| 5661 | it.vpos++; | ||
| 5669 | 5662 | ||
| 5670 | if (old_buffer) | 5663 | if (old_buffer) |
| 5671 | set_buffer_internal (old_buffer); | 5664 | set_buffer_internal (old_buffer); |
| @@ -5940,7 +5933,12 @@ DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, | |||
| 5940 | doc: /* Position point relative to window. | 5933 | doc: /* Position point relative to window. |
| 5941 | ARG nil means position point at center of window. | 5934 | ARG nil means position point at center of window. |
| 5942 | Else, ARG specifies vertical position within the window; | 5935 | Else, ARG specifies vertical position within the window; |
| 5943 | zero means top of window, negative means relative to bottom of window. */) | 5936 | zero means top of window, negative means relative to bottom |
| 5937 | of window, -1 meaning the last fully visible display line | ||
| 5938 | of the window. | ||
| 5939 | |||
| 5940 | Value is the screen line of the window point moved to, counting | ||
| 5941 | from the top of the window. */) | ||
| 5944 | (Lisp_Object arg) | 5942 | (Lisp_Object arg) |
| 5945 | { | 5943 | { |
| 5946 | struct window *w = XWINDOW (selected_window); | 5944 | struct window *w = XWINDOW (selected_window); |