[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 9fc22fb: Fix cursor position under scroll-conservat
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 9fc22fb: Fix cursor position under scroll-conservatively and overlay strings |
Date: |
Mon, 8 Aug 2016 15:16:51 +0000 (UTC) |
branch: master
commit 9fc22fb932599fe4fecffffa920abe509ab5cbb0
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Fix cursor position under scroll-conservatively and overlay strings
* src/xdisp.c (try_scrolling): Handle the case where the last
visible screen line of a window displays a before- or after-string
that takes up the whole screen line, and therefore there's no
place to display the cursor, even though the window does seem to
include the position of point. (Bug#24179)
---
src/xdisp.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/src/xdisp.c b/src/xdisp.c
index efd5f54..21fc01f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15313,6 +15313,40 @@ try_scrolling (Lisp_Object window, bool
just_this_one_p,
if (dy > 0)
scroll_down_p = true;
}
+ else if (PT == IT_CHARPOS (it)
+ && IT_CHARPOS (it) < ZV
+ && it.method == GET_FROM_STRING
+ && arg_scroll_conservatively > scroll_limit
+ && it.current_x == 0)
+ {
+ enum move_it_result skip;
+ int y1 = it.current_y;
+ int vpos;
+
+ /* A before-string that includes newlines and is displayed
+ on the last visible screen line could fail us under
+ scroll-conservatively > 100, because we will be unable to
+ position the cursor on that last visible line. Try to
+ recover by finding the first screen line that has some
+ glyphs coming from the buffer text. */
+ do {
+ skip = move_it_in_display_line_to (&it, ZV, -1, MOVE_TO_POS);
+ if (skip != MOVE_NEWLINE_OR_CR
+ || IT_CHARPOS (it) != PT
+ || it.method == GET_FROM_BUFFER)
+ break;
+ vpos = it.vpos;
+ move_it_to (&it, -1, -1, -1, vpos + 1, MOVE_TO_VPOS);
+ } while (it.vpos > vpos);
+
+ dy = it.current_y - y1;
+
+ if (dy > scroll_max)
+ return SCROLLING_FAILED;
+
+ if (dy > 0)
+ scroll_down_p = true;
+ }
}
if (scroll_down_p)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 9fc22fb: Fix cursor position under scroll-conservatively and overlay strings,
Eli Zaretskii <=