aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-04-07 10:54:56 +0300
committerEli Zaretskii2012-04-07 10:54:56 +0300
commit3811fdf3e8b65f39d6388768a3c9643fe293f7f1 (patch)
treeb41c407a015273270356c79eeca6e82517225ca6 /src
parent2f8e16b2a3c5782a3c8266cc76fbba80d506b93d (diff)
downloademacs-3811fdf3e8b65f39d6388768a3c9643fe293f7f1.tar.gz
emacs-3811fdf3e8b65f39d6388768a3c9643fe293f7f1.zip
Fix bug #11133 with vertical-motion across a long display string.
src/indent.c (Fvertical_motion): If there is a display string at point, use it.vpos to compute how many lines to backtrack after move_it_to point.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/indent.c14
2 files changed, 19 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index af65d38a33b..6bd946c0900 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12012-04-07 Eli Zaretskii <eliz@gnu.org>
2
3 * indent.c (Fvertical_motion): If there is a display string at
4 point, use it.vpos to compute how many lines to backtrack after
5 move_it_to point. (Bug#11133)
6
12012-04-06 Eli Zaretskii <eliz@gnu.org> 72012-04-06 Eli Zaretskii <eliz@gnu.org>
2 8
3 * buffer.h (FETCH_CHAR, FETCH_MULTIBYTE_CHAR): 9 * buffer.h (FETCH_CHAR, FETCH_MULTIBYTE_CHAR):
diff --git a/src/indent.c b/src/indent.c
index a1fcd2b1018..9b4279f0c4e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2021,6 +2021,7 @@ whether or not it is currently displayed in some window. */)
2021 EMACS_INT it_start; 2021 EMACS_INT it_start;
2022 int first_x, it_overshoot_count = 0; 2022 int first_x, it_overshoot_count = 0;
2023 int overshoot_handled = 0; 2023 int overshoot_handled = 0;
2024 int disp_string_at_start_p = 0;
2024 2025
2025 itdata = bidi_shelve_cache (); 2026 itdata = bidi_shelve_cache ();
2026 SET_TEXT_POS (pt, PT, PT_BYTE); 2027 SET_TEXT_POS (pt, PT, PT_BYTE);
@@ -2035,6 +2036,8 @@ whether or not it is currently displayed in some window. */)
2035 { 2036 {
2036 const char *s = SSDATA (it.string); 2037 const char *s = SSDATA (it.string);
2037 const char *e = s + SBYTES (it.string); 2038 const char *e = s + SBYTES (it.string);
2039
2040 disp_string_at_start_p = it.string_from_display_prop_p;
2038 while (s < e) 2041 while (s < e)
2039 { 2042 {
2040 if (*s++ == '\n') 2043 if (*s++ == '\n')
@@ -2062,7 +2065,8 @@ whether or not it is currently displayed in some window. */)
2062 /* IT may move too far if truncate-lines is on and PT lies 2065 /* IT may move too far if truncate-lines is on and PT lies
2063 beyond the right margin. IT may also move too far if the 2066 beyond the right margin. IT may also move too far if the
2064 starting point is on a Lisp string that has embedded 2067 starting point is on a Lisp string that has embedded
2065 newlines. In these cases, backtrack. */ 2068 newlines, or spans several screen lines. In these cases,
2069 backtrack. */
2066 if (IT_CHARPOS (it) > it_start) 2070 if (IT_CHARPOS (it) > it_start)
2067 { 2071 {
2068 /* We need to backtrack also if the Lisp string contains no 2072 /* We need to backtrack also if the Lisp string contains no
@@ -2073,6 +2077,14 @@ whether or not it is currently displayed in some window. */)
2073 && it.method == GET_FROM_BUFFER 2077 && it.method == GET_FROM_BUFFER
2074 && it.c == '\n') 2078 && it.c == '\n')
2075 it_overshoot_count = 1; 2079 it_overshoot_count = 1;
2080 else if (disp_string_at_start_p && it.vpos > 0)
2081 {
2082 /* This is the case of a display string that spans
2083 several screen lines. In that case, we end up at the
2084 end of the string, and it.vpos tells us how many
2085 screen lines we need to backtrack. */
2086 it_overshoot_count = it.vpos;
2087 }
2076 if (it_overshoot_count > 0) 2088 if (it_overshoot_count > 0)
2077 move_it_by_lines (&it, -it_overshoot_count); 2089 move_it_by_lines (&it, -it_overshoot_count);
2078 2090