From 0fd37545dff858ade4558a3742df39d6e9d2ca86 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Mon, 27 Nov 2000 16:18:37 +0000 Subject: [PATCH] (forward_to_next_line_start): If already on a newline, just consume it to avoid unintended skipping over invisible text below. --- src/xdisp.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 16ac7dba318..ac16e694b57 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3392,7 +3392,14 @@ back_to_previous_line_start (it) Newlines may come from buffer text, overlay strings, or strings displayed via the `display' property. That's the reason we can't - simply use find_next_newline_no_quit. */ + simply use find_next_newline_no_quit. + + Note that this function may not skip over invisible text that is so + because of text properties and immediately follows a newline. If + it would, function reseat_at_next_visible_line_start, when called + from set_iterator_to_next, would effectively make invisible + characters following a newline part of the wrong glyph row, which + leads to wrong cursor motion. */ static int forward_to_next_line_start (it, skipped_p) @@ -3402,9 +3409,18 @@ forward_to_next_line_start (it, skipped_p) int old_selective, newline_found_p, n; const int MAX_NEWLINE_DISTANCE = 500; + /* If already on a newline, just consume it to avoid unintended + skipping over invisible text below. */ + if (ITERATOR_AT_END_OF_LINE_P (it)) + { + set_iterator_to_next (it, 0); + return 1; + } + /* Don't handle selective display in the following. It's (a) - unnecessary and (b) leads to an infinite recursion because - next_element_from_ellipsis indirectly calls this function. */ + unnecessary because it's done by the caller, and (b) leads to an + infinite recursion because next_element_from_ellipsis indirectly + calls this function. */ old_selective = it->selective; it->selective = 0; @@ -11851,7 +11867,7 @@ highlight_trailing_whitespace (f, row) /* Value is non-zero if glyph row ROW in window W should be - used to put the cursor on. */ + used to hold the cursor. */ static int cursor_row_p (w, row) -- 2.39.5