diff options
| author | Gerd Moellmann | 2000-10-26 12:44:20 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-26 12:44:20 +0000 |
| commit | fcab195473b33967f87f477ed2e51b81382f3cf5 (patch) | |
| tree | 2d6dcecf43744cd601c5a7d8785a27ce6cbcf4c5 | |
| parent | b94fdf61ba670eff6daadc11795404c704691f05 (diff) | |
| download | emacs-fcab195473b33967f87f477ed2e51b81382f3cf5.tar.gz emacs-fcab195473b33967f87f477ed2e51b81382f3cf5.zip | |
(pos_visible_p): Change current buffer if necessary.
Handle obscured lines at the top of the window.
| -rw-r--r-- | src/xdisp.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index bcb285ae134..f229198d8f4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -940,7 +940,14 @@ pos_visible_p (w, charpos, fully) | |||
| 940 | { | 940 | { |
| 941 | struct it it; | 941 | struct it it; |
| 942 | struct text_pos top; | 942 | struct text_pos top; |
| 943 | int visible_p, bottom_y; | 943 | int visible_p; |
| 944 | struct buffer *old_buffer = NULL; | ||
| 945 | |||
| 946 | if (XBUFFER (w->buffer) != current_buffer) | ||
| 947 | { | ||
| 948 | old_buffer = current_buffer; | ||
| 949 | set_buffer_internal_1 (XBUFFER (w->buffer)); | ||
| 950 | } | ||
| 944 | 951 | ||
| 945 | *fully = visible_p = 0; | 952 | *fully = visible_p = 0; |
| 946 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 953 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| @@ -951,15 +958,32 @@ pos_visible_p (w, charpos, fully) | |||
| 951 | 958 | ||
| 952 | if (IT_CHARPOS (it) == charpos) | 959 | if (IT_CHARPOS (it) == charpos) |
| 953 | { | 960 | { |
| 954 | int line_height; | 961 | int line_height, line_bottom_y; |
| 955 | 962 | int line_top_y = it.current_y; | |
| 956 | if (it.max_ascent == 0 && it.max_descent == 0) | 963 | int window_top_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
| 957 | line_height = last_height; | ||
| 958 | else | ||
| 959 | line_height = it.max_ascent + it.max_descent; | ||
| 960 | 964 | ||
| 961 | *fully = it.current_y + line_height <= it.last_visible_y; | 965 | line_height = it.max_ascent + it.max_descent; |
| 962 | visible_p = 1; | 966 | if (line_height == 0) |
| 967 | { | ||
| 968 | if (last_height) | ||
| 969 | line_height = last_height; | ||
| 970 | else | ||
| 971 | { | ||
| 972 | move_it_by_lines (&it, 1, 1); | ||
| 973 | line_height = (it.max_ascent || it.max_descent | ||
| 974 | ? it.max_ascent + it.max_descent | ||
| 975 | : last_height); | ||
| 976 | } | ||
| 977 | } | ||
| 978 | line_bottom_y = line_top_y + line_height; | ||
| 979 | |||
| 980 | if (line_top_y < window_top_y) | ||
| 981 | visible_p = line_bottom_y > window_top_y; | ||
| 982 | else if (line_top_y < it.last_visible_y) | ||
| 983 | { | ||
| 984 | visible_p = 1; | ||
| 985 | *fully = line_bottom_y <= it.last_visible_y; | ||
| 986 | } | ||
| 963 | } | 987 | } |
| 964 | else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) | 988 | else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) |
| 965 | { | 989 | { |
| @@ -970,6 +994,9 @@ pos_visible_p (w, charpos, fully) | |||
| 970 | *fully = 0; | 994 | *fully = 0; |
| 971 | } | 995 | } |
| 972 | } | 996 | } |
| 997 | |||
| 998 | if (old_buffer) | ||
| 999 | set_buffer_internal_1 (old_buffer); | ||
| 973 | 1000 | ||
| 974 | return visible_p; | 1001 | return visible_p; |
| 975 | } | 1002 | } |