diff options
| author | Gerd Moellmann | 2000-10-25 11:53:54 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-25 11:53:54 +0000 |
| commit | 53bb6b996b70af0f8efe2360cf8adcb238d45c06 (patch) | |
| tree | cb45c6b4cfaf37e0d641c4d7092e17bf6cf7e019 /src/window.c | |
| parent | eff8b78d7fc1dc25375e0fff55680a15787d994a (diff) | |
| download | emacs-53bb6b996b70af0f8efe2360cf8adcb238d45c06.tar.gz emacs-53bb6b996b70af0f8efe2360cf8adcb238d45c06.zip | |
(pos_fully_visible_p): Removed.
(Fpos_visible_in_window_p): Use pos_visible_p to determine
if position is visible and/or fully visible.
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 80 |
1 files changed, 18 insertions, 62 deletions
diff --git a/src/window.c b/src/window.c index 3f08e64a26b..2db5ddd2215 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -290,53 +290,16 @@ DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, | |||
| 290 | Lisp_Object window; | 290 | Lisp_Object window; |
| 291 | { | 291 | { |
| 292 | struct window *w = decode_window (window); | 292 | struct window *w = decode_window (window); |
| 293 | return (MINI_WINDOW_P (w) ? Qt : Qnil); | 293 | return MINI_WINDOW_P (w) ? Qt : Qnil; |
| 294 | } | ||
| 295 | |||
| 296 | |||
| 297 | /* Return true if POS is fully visible in the window W. If W's end | ||
| 298 | position is not known, then return false. */ | ||
| 299 | |||
| 300 | static int | ||
| 301 | pos_fully_visible_in_window_p (pos, w) | ||
| 302 | int pos; | ||
| 303 | struct window *w; | ||
| 304 | { | ||
| 305 | struct glyph_row *first_row = &w->desired_matrix->rows[0]; | ||
| 306 | struct glyph_row *last_row; | ||
| 307 | |||
| 308 | if (pos < first_row->start.pos.charpos) | ||
| 309 | /* POS is before the beginning of W. */ | ||
| 310 | return 0; | ||
| 311 | else if (pos < first_row->end.pos.charpos) | ||
| 312 | /* POS is on the first row of W, so see if that row is fully visible. */ | ||
| 313 | return !MATRIX_ROW_PARTIALLY_VISIBLE_P (first_row); | ||
| 314 | |||
| 315 | if (NILP (w->window_end_valid)) | ||
| 316 | /* We can't determine where the end is, so we don't know. */ | ||
| 317 | return 0; | ||
| 318 | |||
| 319 | last_row = &w->desired_matrix->rows[XFASTINT (w->window_end_vpos)]; | ||
| 320 | |||
| 321 | if (pos < last_row->start.pos.charpos) | ||
| 322 | /* POS is somewhere in the middle of the window, not on the first or | ||
| 323 | last row, so it must be visible. */ | ||
| 324 | return 1; | ||
| 325 | else if (pos >= last_row->end.pos.charpos) | ||
| 326 | /* POS is after the end of W. */ | ||
| 327 | return 0; | ||
| 328 | else | ||
| 329 | /* POS is on the last row of W, so see if that row is fully visible. */ | ||
| 330 | return !MATRIX_ROW_PARTIALLY_VISIBLE_P (last_row); | ||
| 331 | } | 294 | } |
| 332 | 295 | ||
| 333 | 296 | ||
| 334 | DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | 297 | DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, |
| 335 | Spos_visible_in_window_p, 0, 3, 0, | 298 | Spos_visible_in_window_p, 0, 3, 0, |
| 336 | "Return t if position POS is currently on the frame in WINDOW.\n\ | 299 | "Return t if position POS is currently on the frame in WINDOW.\n\ |
| 337 | Returns nil if that position is scrolled vertically out of view.\n\ | 300 | Return nil if that position is scrolled vertically out of view.\n\ |
| 338 | If FULLY is non-nil, then only return t when POS is completely visible.\n\ | 301 | If FULLY is non-nil, then only return t when POS is completely visible.\n\ |
| 339 | POS defaults to point; WINDOW, to the selected window.") | 302 | POS defaults to point; WINDOW defaults to the selected window.") |
| 340 | (pos, window, fully) | 303 | (pos, window, fully) |
| 341 | Lisp_Object pos, window, fully; | 304 | Lisp_Object pos, window, fully; |
| 342 | { | 305 | { |
| @@ -345,6 +308,7 @@ POS defaults to point; WINDOW, to the selected window.") | |||
| 345 | register struct buffer *buf; | 308 | register struct buffer *buf; |
| 346 | struct text_pos top; | 309 | struct text_pos top; |
| 347 | Lisp_Object in_window; | 310 | Lisp_Object in_window; |
| 311 | int fully_p; | ||
| 348 | 312 | ||
| 349 | if (NILP (pos)) | 313 | if (NILP (pos)) |
| 350 | posint = PT; | 314 | posint = PT; |
| @@ -358,21 +322,24 @@ POS defaults to point; WINDOW, to the selected window.") | |||
| 358 | buf = XBUFFER (w->buffer); | 322 | buf = XBUFFER (w->buffer); |
| 359 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 323 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 360 | 324 | ||
| 361 | /* If position above window, it's not visible. */ | 325 | /* If position is above window start, it's not visible. */ |
| 362 | if (posint < CHARPOS (top)) | 326 | if (posint < CHARPOS (top)) |
| 363 | in_window = Qnil; | 327 | in_window = Qnil; |
| 364 | else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) | 328 | else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) |
| 365 | && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf) | 329 | && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf) |
| 366 | && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos)) | 330 | && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos)) |
| 367 | /* If frame is up to date, and POSINT is < window end pos, use | ||
| 368 | that info. This doesn't work for POSINT == end pos, because | ||
| 369 | the window end pos is actually the position _after_ the last | ||
| 370 | char in the window. */ | ||
| 371 | { | 331 | { |
| 372 | if (NILP (fully) || pos_fully_visible_in_window_p (posint, w)) | 332 | /* If frame is up-to-date, and POSINT is < window end pos, use |
| 373 | in_window = Qt; | 333 | that info. This doesn't work for POSINT == end pos, because |
| 334 | the window end pos is actually the position _after_ the last | ||
| 335 | char in the window. */ | ||
| 336 | if (!NILP (fully)) | ||
| 337 | { | ||
| 338 | pos_visible_p (w, posint, &fully_p); | ||
| 339 | in_window = fully_p ? Qt : Qnil; | ||
| 340 | } | ||
| 374 | else | 341 | else |
| 375 | in_window = Qnil; | 342 | in_window = Qt; |
| 376 | } | 343 | } |
| 377 | else if (posint > BUF_ZV (buf)) | 344 | else if (posint > BUF_ZV (buf)) |
| 378 | in_window = Qnil; | 345 | in_window = Qnil; |
| @@ -381,26 +348,15 @@ POS defaults to point; WINDOW, to the selected window.") | |||
| 381 | in_window = Qnil; | 348 | in_window = Qnil; |
| 382 | else | 349 | else |
| 383 | { | 350 | { |
| 384 | struct it it; | 351 | if (pos_visible_p (w, posint, &fully_p)) |
| 385 | start_display (&it, w, top); | 352 | in_window = NILP (fully) || fully_p ? Qt : Qnil; |
| 386 | move_it_to (&it, posint, 0, it.last_visible_y, -1, | ||
| 387 | MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); | ||
| 388 | if (IT_CHARPOS (it) == posint) | ||
| 389 | { | ||
| 390 | if (NILP (fully)) | ||
| 391 | in_window = Qt; | ||
| 392 | else | ||
| 393 | { | ||
| 394 | struct glyph_row *pos_row = &w->desired_matrix->rows[it.vpos]; | ||
| 395 | return MATRIX_ROW_PARTIALLY_VISIBLE_P(pos_row) ? Qnil : Qt; | ||
| 396 | } | ||
| 397 | } | ||
| 398 | else | 353 | else |
| 399 | in_window = Qnil; | 354 | in_window = Qnil; |
| 400 | } | 355 | } |
| 401 | 356 | ||
| 402 | return in_window; | 357 | return in_window; |
| 403 | } | 358 | } |
| 359 | |||
| 404 | 360 | ||
| 405 | static struct window * | 361 | static struct window * |
| 406 | decode_window (window) | 362 | decode_window (window) |