aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2007-01-05 15:00:45 +0000
committerKim F. Storm2007-01-05 15:00:45 +0000
commit9e313cc1222f5a8d9cb520657a9fd94b768bf5f2 (patch)
tree489dfc1c27fc88e88725d6362b22bc44630cd791
parent5be70981233c2c16d336a00ec427000caafe50dc (diff)
downloademacs-9e313cc1222f5a8d9cb520657a9fd94b768bf5f2.tar.gz
emacs-9e313cc1222f5a8d9cb520657a9fd94b768bf5f2.zip
(Fvertical_motion): Fix IT overshoot check for overlay
strings without embedded newlines immediately followed by newline.
-rw-r--r--src/indent.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/indent.c b/src/indent.c
index a30ef6edf7b..da31060e181 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2074,7 +2074,7 @@ whether or not it is currently displayed in some window. */)
2074 { 2074 {
2075 int it_start; 2075 int it_start;
2076 int oselective; 2076 int oselective;
2077 int it_overshoot_expected_p; 2077 int it_overshoot_expected;
2078 2078
2079 SET_TEXT_POS (pt, PT, PT_BYTE); 2079 SET_TEXT_POS (pt, PT, PT_BYTE);
2080 start_display (&it, w, pt); 2080 start_display (&it, w, pt);
@@ -2100,12 +2100,16 @@ whether or not it is currently displayed in some window. */)
2100 while (s < e && *s != '\n') 2100 while (s < e && *s != '\n')
2101 ++s; 2101 ++s;
2102 2102
2103 it_overshoot_expected_p = (s == e); 2103 /* If there is no newline in the string, we need to check
2104 whether there is a newline immediately after the string
2105 in move_it_to below. This may happen if there is an
2106 overlay with an after-string just before the newline. */
2107 it_overshoot_expected = (s == e) ? -1 : 0;
2104 } 2108 }
2105 else 2109 else
2106 it_overshoot_expected_p = (it.method == GET_FROM_IMAGE 2110 it_overshoot_expected = (it.method == GET_FROM_IMAGE
2107 || it.method == GET_FROM_STRETCH 2111 || it.method == GET_FROM_STRETCH
2108 || it.method == GET_FROM_COMPOSITION); 2112 || it.method == GET_FROM_COMPOSITION);
2109 2113
2110 reseat_at_previous_visible_line_start (&it); 2114 reseat_at_previous_visible_line_start (&it);
2111 it.current_x = it.hpos = 0; 2115 it.current_x = it.hpos = 0;
@@ -2119,7 +2123,10 @@ whether or not it is currently displayed in some window. */)
2119 truncate-lines is on and PT is beyond right margin. 2123 truncate-lines is on and PT is beyond right margin.
2120 Don't go back if the overshoot is expected (see above). */ 2124 Don't go back if the overshoot is expected (see above). */
2121 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0 2125 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0
2122 && !it_overshoot_expected_p) 2126 && (!it_overshoot_expected
2127 || (it_overshoot_expected < 0
2128 && it.method == GET_FROM_BUFFER
2129 && it.c == '\n')))
2123 move_it_by_lines (&it, -1, 0); 2130 move_it_by_lines (&it, -1, 0);
2124 2131
2125 it.vpos = 0; 2132 it.vpos = 0;