aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/xdisp.c27
2 files changed, 29 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7352d8e0081..2f3643f4f80 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -14,6 +14,9 @@
14 proceed to consider_string_end without incrementing string 14 proceed to consider_string_end without incrementing string
15 position. Don't increment display vector index past the end of 15 position. Don't increment display vector index past the end of
16 the display vector. (Bug#11417) 16 the display vector. (Bug#11417)
17 (pos_visible_p): Don't report a position visible when move_it_to
18 stopped at the last line of window, which happens to be scanned
19 backwards by the bidi iteration. (Bug#11464)
17 20
182012-05-11 Eli Zaretskii <eliz@gnu.org> 212012-05-11 Eli Zaretskii <eliz@gnu.org>
19 22
diff --git a/src/xdisp.c b/src/xdisp.c
index b1e2a925bce..a2c4589766d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1304,8 +1304,8 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
1304 glyph. */ 1304 glyph. */
1305 int top_x = it.current_x; 1305 int top_x = it.current_x;
1306 int top_y = it.current_y; 1306 int top_y = it.current_y;
1307 enum it_method it_method = it.method;
1308 /* Calling line_bottom_y may change it.method, it.position, etc. */ 1307 /* Calling line_bottom_y may change it.method, it.position, etc. */
1308 enum it_method it_method = it.method;
1309 int bottom_y = (last_height = 0, line_bottom_y (&it)); 1309 int bottom_y = (last_height = 0, line_bottom_y (&it));
1310 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); 1310 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
1311 1311
@@ -1313,6 +1313,31 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
1313 visible_p = bottom_y > window_top_y; 1313 visible_p = bottom_y > window_top_y;
1314 else if (top_y < it.last_visible_y) 1314 else if (top_y < it.last_visible_y)
1315 visible_p = 1; 1315 visible_p = 1;
1316 if (bottom_y >= it.last_visible_y
1317 && it.bidi_p && it.bidi_it.scan_dir == -1
1318 && IT_CHARPOS (it) < charpos)
1319 {
1320 /* When the last line of the window is scanned backwards
1321 under bidi iteration, we could be duped into thinking
1322 that we have passed CHARPOS, when in fact move_it_to
1323 simply stopped short of CHARPOS because it reached
1324 last_visible_y. To see if that's what happened, we call
1325 move_it_to again with a slightly larger vertical limit,
1326 and see if it actually moved vertically; if it did, we
1327 didn't really reach CHARPOS, which is beyond window end. */
1328 struct it save_it = it;
1329 /* Why 10? because we don't know how many canonical lines
1330 will the height of the next line(s) be. So we guess. */
1331 int ten_more_lines =
1332 10 * FRAME_LINE_HEIGHT (XFRAME (WINDOW_FRAME (w)));
1333
1334 move_it_to (&it, charpos, -1, bottom_y + ten_more_lines, -1,
1335 MOVE_TO_POS | MOVE_TO_Y);
1336 if (it.current_y > top_y)
1337 visible_p = 0;
1338
1339 it = save_it;
1340 }
1316 if (visible_p) 1341 if (visible_p)
1317 { 1342 {
1318 if (it_method == GET_FROM_DISPLAY_VECTOR) 1343 if (it_method == GET_FROM_DISPLAY_VECTOR)