diff options
| author | Gerd Moellmann | 1999-08-17 00:38:14 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-08-17 00:38:14 +0000 |
| commit | 9a132b1f433c9a57fbcc575e73d73956fdb0d446 (patch) | |
| tree | 751e270a51edf8a8d29fef9c3d364851e1fda0af /src | |
| parent | 41f8865874548e844d7f77611d5da05d1b271b89 (diff) | |
| download | emacs-9a132b1f433c9a57fbcc575e73d73956fdb0d446.tar.gz emacs-9a132b1f433c9a57fbcc575e73d73956fdb0d446.zip | |
(Fpos_visible_in_window_p): Rewritten.
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/src/window.c b/src/window.c index 5c0abd6e93d..92608175247 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -269,9 +269,10 @@ POS defaults to point; WINDOW, to the selected window.") | |||
| 269 | Lisp_Object pos, window; | 269 | Lisp_Object pos, window; |
| 270 | { | 270 | { |
| 271 | register struct window *w; | 271 | register struct window *w; |
| 272 | struct text_pos top; | ||
| 273 | register int posint; | 272 | register int posint; |
| 274 | register struct buffer *buf; | 273 | register struct buffer *buf; |
| 274 | struct text_pos top; | ||
| 275 | Lisp_Object in_window; | ||
| 275 | 276 | ||
| 276 | if (NILP (pos)) | 277 | if (NILP (pos)) |
| 277 | posint = PT; | 278 | posint = PT; |
| @@ -282,39 +283,35 @@ POS defaults to point; WINDOW, to the selected window.") | |||
| 282 | } | 283 | } |
| 283 | 284 | ||
| 284 | w = decode_window (window); | 285 | w = decode_window (window); |
| 286 | buf = XBUFFER (w->buffer); | ||
| 285 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 287 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 286 | 288 | ||
| 287 | /* If position above window, it's not visible. */ | 289 | /* If position above window, it's not visible. */ |
| 288 | if (posint < CHARPOS (top)) | 290 | if (posint < CHARPOS (top)) |
| 289 | return Qnil; | 291 | in_window = Qnil; |
| 290 | 292 | else if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) | |
| 291 | buf = XBUFFER (w->buffer); | 293 | && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf) |
| 292 | if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf) | 294 | && posint < BUF_Z (buf) - XFASTINT (w->window_end_pos)) |
| 293 | && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (buf)) | 295 | /* If frame is up to date, and POSINT is < window end pos, use |
| 294 | { | 296 | that info. This doesn't work for POSINT == end pos, because |
| 295 | /* If frame is up to date, | 297 | the window end pos is actually the position _after_ the last |
| 296 | use the info recorded about how much text fit on it. */ | 298 | char in the window. */ |
| 297 | if (posint < BUF_Z (buf) - XFASTINT (w->window_end_pos)) | 299 | in_window = Qt; |
| 298 | return Qt; | 300 | else if (posint > BUF_ZV (buf)) |
| 299 | return Qnil; | 301 | in_window = Qnil; |
| 300 | } | 302 | else if (CHARPOS (top) < BUF_BEGV (buf) || CHARPOS (top) > BUF_ZV (buf)) |
| 303 | /* If window start is out of range, do something reasonable. */ | ||
| 304 | in_window = Qnil; | ||
| 301 | else | 305 | else |
| 302 | { | 306 | { |
| 303 | struct it it; | 307 | struct it it; |
| 304 | |||
| 305 | if (posint > BUF_ZV (buf)) | ||
| 306 | return Qnil; | ||
| 307 | |||
| 308 | /* w->start can be out of range. If it is, do something reasonable. */ | ||
| 309 | if (CHARPOS (top) < BUF_BEGV (buf) | ||
| 310 | || CHARPOS (top) > BUF_ZV (buf)) | ||
| 311 | return Qnil; | ||
| 312 | |||
| 313 | start_display (&it, w, top); | 308 | start_display (&it, w, top); |
| 314 | move_it_to (&it, posint, 0, it.last_visible_y, -1, | 309 | move_it_to (&it, posint, 0, it.last_visible_y, -1, |
| 315 | MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); | 310 | MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); |
| 316 | return IT_CHARPOS (it) == posint ? Qt : Qnil; | 311 | in_window = IT_CHARPOS (it) == posint ? Qt : Qnil; |
| 317 | } | 312 | } |
| 313 | |||
| 314 | return in_window; | ||
| 318 | } | 315 | } |
| 319 | 316 | ||
| 320 | static struct window * | 317 | static struct window * |