aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 762b6937b78..4e47f4957d2 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1272,13 +1272,12 @@ line_bottom_y (it)
1272/* Return 1 if position CHARPOS is visible in window W. 1272/* Return 1 if position CHARPOS is visible in window W.
1273 If visible, set *X and *Y to pixel coordinates of top left corner. 1273 If visible, set *X and *Y to pixel coordinates of top left corner.
1274 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS. 1274 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS.
1275 EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line 1275 Set *ROWH and *VPOS to row's visible height and VPOS (row number). */
1276 and header-lines heights. */
1277 1276
1278int 1277int
1279pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) 1278pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos)
1280 struct window *w; 1279 struct window *w;
1281 int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; 1280 int charpos, *x, *y, *rtop, *rbot, *rowh, *vpos;
1282{ 1281{
1283 struct it it; 1282 struct it it;
1284 struct text_pos top; 1283 struct text_pos top;
@@ -1296,22 +1295,19 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1296 1295
1297 SET_TEXT_POS_FROM_MARKER (top, w->start); 1296 SET_TEXT_POS_FROM_MARKER (top, w->start);
1298 1297
1299 /* Compute exact mode line heights, if requested. */ 1298 /* Compute exact mode line heights. */
1300 if (exact_mode_line_heights_p) 1299 if (WINDOW_WANTS_MODELINE_P (w))
1301 { 1300 current_mode_line_height
1302 if (WINDOW_WANTS_MODELINE_P (w)) 1301 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1303 current_mode_line_height 1302 current_buffer->mode_line_format);
1304 = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w),
1305 current_buffer->mode_line_format);
1306 1303
1307 if (WINDOW_WANTS_HEADER_LINE_P (w)) 1304 if (WINDOW_WANTS_HEADER_LINE_P (w))
1308 current_header_line_height 1305 current_header_line_height
1309 = display_mode_line (w, HEADER_LINE_FACE_ID, 1306 = display_mode_line (w, HEADER_LINE_FACE_ID,
1310 current_buffer->header_line_format); 1307 current_buffer->header_line_format);
1311 }
1312 1308
1313 start_display (&it, w, top); 1309 start_display (&it, w, top);
1314 move_it_to (&it, charpos, -1, it.last_visible_y, -1, 1310 move_it_to (&it, charpos, -1, it.last_visible_y-1, -1,
1315 MOVE_TO_POS | MOVE_TO_Y); 1311 MOVE_TO_POS | MOVE_TO_Y);
1316 1312
1317 /* Note that we may overshoot because of invisible text. */ 1313 /* Note that we may overshoot because of invisible text. */
@@ -1332,6 +1328,9 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1332 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); 1328 *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
1333 *rtop = max (0, window_top_y - top_y); 1329 *rtop = max (0, window_top_y - top_y);
1334 *rbot = max (0, bottom_y - it.last_visible_y); 1330 *rbot = max (0, bottom_y - it.last_visible_y);
1331 *rowh = max (0, (min (bottom_y, it.last_visible_y)
1332 - max (top_y, window_top_y)));
1333 *vpos = it.vpos;
1335 } 1334 }
1336 } 1335 }
1337 else 1336 else
@@ -1350,6 +1349,11 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1350 *rtop = max (0, -it2.current_y); 1349 *rtop = max (0, -it2.current_y);
1351 *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent) 1350 *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent)
1352 - it.last_visible_y)); 1351 - it.last_visible_y));
1352 *rowh = max (0, (min (it2.current_y + it2.max_ascent + it2.max_descent,
1353 it.last_visible_y)
1354 - max (it2.current_y,
1355 WINDOW_HEADER_LINE_HEIGHT (w))));
1356 *vpos = it2.vpos;
1353 } 1357 }
1354 } 1358 }
1355 1359
@@ -1361,6 +1365,15 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p)
1361 if (visible_p && XFASTINT (w->hscroll) > 0) 1365 if (visible_p && XFASTINT (w->hscroll) > 0)
1362 *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w); 1366 *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w);
1363 1367
1368#if 0
1369 /* Debugging code. */
1370 if (visible_p)
1371 fprintf (stderr, "+pv pt=%d vs=%d --> x=%d y=%d rt=%d rb=%d rh=%d vp=%d\n",
1372 charpos, w->vscroll, *x, *y, *rtop, *rbot, *rowh, *vpos);
1373 else
1374 fprintf (stderr, "-pv pt=%d vs=%d\n", charpos, w->vscroll);
1375#endif
1376
1364 return visible_p; 1377 return visible_p;
1365} 1378}
1366 1379
@@ -12023,7 +12036,8 @@ cursor_row_fully_visible_p (w, force_p, current_matrix_p)
12023 window_height = window_box_height (w); 12036 window_height = window_box_height (w);
12024 if (row->height >= window_height) 12037 if (row->height >= window_height)
12025 { 12038 {
12026 if (!force_p || MINI_WINDOW_P (w) || w->vscroll) 12039 if (!force_p || MINI_WINDOW_P (w)
12040 || w->vscroll || w->cursor.vpos == 0)
12027 return 1; 12041 return 1;
12028 } 12042 }
12029 return 0; 12043 return 0;
@@ -13507,7 +13521,8 @@ try_window (window, pos, check_margins)
13507 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); 13521 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
13508 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 13522 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
13509 13523
13510 if ((w->cursor.y < this_scroll_margin 13524 if ((w->cursor.y >= 0 /* not vscrolled */
13525 && w->cursor.y < this_scroll_margin
13511 && CHARPOS (pos) > BEGV 13526 && CHARPOS (pos) > BEGV
13512 && IT_CHARPOS (it) < ZV) 13527 && IT_CHARPOS (it) < ZV)
13513 /* rms: considering make_cursor_line_fully_visible_p here 13528 /* rms: considering make_cursor_line_fully_visible_p here