aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2006-09-26 19:25:35 +0000
committerChong Yidong2006-09-26 19:25:35 +0000
commit14a7cabfbcb902f8ba56de56a27168d1b8e0d640 (patch)
tree0e8ea2ad40636dfe5ecb8f5bb33b35a4c1730b54 /src
parent90e93246f3c9bcb309d706728c3215ada77638ec (diff)
downloademacs-14a7cabfbcb902f8ba56de56a27168d1b8e0d640.tar.gz
emacs-14a7cabfbcb902f8ba56de56a27168d1b8e0d640.zip
* indent.c (Fvertical_motion): Do move back if the Lisp string
being displayed contains newlines.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/indent.c30
2 files changed, 28 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 147d3533886..5f919ffedef 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12006-09-26 Chong Yidong <cyd@stupidchicken.com>
2
3 * indent.c (Fvertical_motion): Do move back if the Lisp string
4 being displayed contains newlines.
5
12006-09-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 62006-09-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 7
3 * macterm.c (mac_compute_glyph_string_overhangs, XLoadQueryFont) 8 * macterm.c (mac_compute_glyph_string_overhangs, XLoadQueryFont)
diff --git a/src/indent.c b/src/indent.c
index c302c5313e7..3cbb105e80f 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 start_on_image_or_stretch_or_string_p; 2077 int it_overshoot_expected_p;
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);
@@ -2086,9 +2086,26 @@ whether or not it is currently displayed in some window. */)
2086 while the end position is really at some X > 0, the same X that 2086 while the end position is really at some X > 0, the same X that
2087 PT had. */ 2087 PT had. */
2088 it_start = IT_CHARPOS (it); 2088 it_start = IT_CHARPOS (it);
2089 start_on_image_or_stretch_or_string_p = (it.method == GET_FROM_IMAGE 2089
2090 || it.method == GET_FROM_STRETCH 2090 /* We expect the call to move_it_to, further down, to overshoot
2091 || it.method == GET_FROM_STRING); 2091 if the starting point is on an image, stretch glyph, or Lisp
2092 string. We won't need to backtrack in this situation, except
2093 for one corner case: when the Lisp string contains a
2094 newline. */
2095 if (it.method == GET_FROM_STRING)
2096 {
2097 const char *s = SDATA (it.string);
2098 const char *e = s + SBYTES (it.string);
2099
2100 while (s < e && *s != '\n')
2101 ++s;
2102
2103 it_overshoot_expected_p = (s == e);
2104 }
2105 else
2106 it_overshoot_expected_p = (it.method == GET_FROM_IMAGE
2107 || it.method == GET_FROM_STRETCH);
2108
2092 reseat_at_previous_visible_line_start (&it); 2109 reseat_at_previous_visible_line_start (&it);
2093 it.current_x = it.hpos = 0; 2110 it.current_x = it.hpos = 0;
2094 /* Temporarily disable selective display so we don't move too far */ 2111 /* Temporarily disable selective display so we don't move too far */
@@ -2099,10 +2116,9 @@ whether or not it is currently displayed in some window. */)
2099 2116
2100 /* Move back if we got too far. This may happen if 2117 /* Move back if we got too far. This may happen if
2101 truncate-lines is on and PT is beyond right margin. 2118 truncate-lines is on and PT is beyond right margin.
2102 It may also happen if it_start is on an image, stretch 2119 Don't go back if the overshoot is expected (see above). */
2103 glyph, or string -- in that case, don't go back. */
2104 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0 2120 if (IT_CHARPOS (it) > it_start && XINT (lines) > 0
2105 && !start_on_image_or_stretch_or_string_p) 2121 && !it_overshoot_expected_p)
2106 move_it_by_lines (&it, -1, 0); 2122 move_it_by_lines (&it, -1, 0);
2107 2123
2108 it.vpos = 0; 2124 it.vpos = 0;