comparison src/xdisp.c @ 21845:1bae35c78db2

(redisplay_window): Update STARTP_BYTE alongside with STARTP. New variable scroll_margin_bytepos, to parallel scroll_margin_pos. Fix arguments of pos_tab_offset to agree with the first argument of compute_motion.
author Andreas Schwab <schwab@suse.de>
date Wed, 29 Apr 1998 09:46:49 +0000
parents 697991d2a2c4
children e849b602b425
comparison
equal deleted inserted replaced
21844:840db1d2d15c 21845:1bae35c78db2
1950 if (! NILP (Vwindow_scroll_functions)) 1950 if (! NILP (Vwindow_scroll_functions))
1951 { 1951 {
1952 run_hook_with_args_2 (Qwindow_scroll_functions, window, 1952 run_hook_with_args_2 (Qwindow_scroll_functions, window,
1953 make_number (startp)); 1953 make_number (startp));
1954 startp = marker_position (w->start); 1954 startp = marker_position (w->start);
1955 startp_byte = marker_byte_position (w->start);
1955 } 1956 }
1956 } 1957 }
1957 XSETFASTINT (w->last_modified, 0); 1958 XSETFASTINT (w->last_modified, 0);
1958 XSETFASTINT (w->last_overlay_modified, 0); 1959 XSETFASTINT (w->last_overlay_modified, 0);
1959 if (startp < BEGV) startp = BEGV, startp_byte = BEGV_BYTE; 1960 if (startp < BEGV) startp = BEGV, startp_byte = BEGV_BYTE;
2201 2202
2202 if (scroll_conservatively && !current_buffer->clip_changed 2203 if (scroll_conservatively && !current_buffer->clip_changed
2203 && startp >= BEGV && startp <= ZV) 2204 && startp >= BEGV && startp <= ZV)
2204 { 2205 {
2205 int this_scroll_margin = scroll_margin; 2206 int this_scroll_margin = scroll_margin;
2206 int scroll_margin_pos; 2207 int scroll_margin_pos, scroll_margin_bytepos;
2207 2208
2208 /* Don't use a scroll margin that is negative or too large. */ 2209 /* Don't use a scroll margin that is negative or too large. */
2209 if (this_scroll_margin < 0) 2210 if (this_scroll_margin < 0)
2210 this_scroll_margin = 0; 2211 this_scroll_margin = 0;
2211 2212
2215 scroll_margin_pos = Z - XFASTINT (w->window_end_pos); 2216 scroll_margin_pos = Z - XFASTINT (w->window_end_pos);
2216 if (this_scroll_margin) 2217 if (this_scroll_margin)
2217 { 2218 {
2218 pos = *vmotion (scroll_margin_pos, -this_scroll_margin, w); 2219 pos = *vmotion (scroll_margin_pos, -this_scroll_margin, w);
2219 scroll_margin_pos = pos.bufpos; 2220 scroll_margin_pos = pos.bufpos;
2220 } 2221 scroll_margin_bytepos = pos.bytepos;
2222 }
2223 else
2224 scroll_margin_bytepos = CHAR_TO_BYTE (scroll_margin_pos);
2225
2221 if (PT >= scroll_margin_pos) 2226 if (PT >= scroll_margin_pos)
2222 { 2227 {
2223 struct position pos; 2228 struct position pos;
2224 pos = *compute_motion (scroll_margin_pos, 0, 0, 0, 2229 pos = *compute_motion (scroll_margin_pos, 0, 0, 0,
2225 PT, XFASTINT (w->height), 0, 2230 PT, XFASTINT (w->height), 0,
2226 XFASTINT (w->width), XFASTINT (w->hscroll), 2231 XFASTINT (w->width), XFASTINT (w->hscroll),
2227 pos_tab_offset (w, startp, startp_byte), 2232 pos_tab_offset (w, scroll_margin_pos,
2233 scroll_margin_bytepos),
2228 w); 2234 w);
2229 if (pos.vpos > scroll_conservatively) 2235 if (pos.vpos > scroll_conservatively)
2230 goto scroll_fail_1; 2236 goto scroll_fail_1;
2231 2237
2232 pos = *vmotion (startp, pos.vpos + 1, w); 2238 pos = *vmotion (startp, pos.vpos + 1, w);
2261 { 2267 {
2262 struct position pos; 2268 struct position pos;
2263 pos = *compute_motion (PT, 0, 0, 0, 2269 pos = *compute_motion (PT, 0, 0, 0,
2264 scroll_margin_pos, XFASTINT (w->height), 0, 2270 scroll_margin_pos, XFASTINT (w->height), 0,
2265 XFASTINT (w->width), XFASTINT (w->hscroll), 2271 XFASTINT (w->width), XFASTINT (w->hscroll),
2266 pos_tab_offset (w, startp, startp_byte), 2272 pos_tab_offset (w, PT, PT_BYTE),
2267 w); 2273 w);
2268 if (pos.vpos > scroll_conservatively) 2274 if (pos.vpos > scroll_conservatively)
2269 goto scroll_fail_1; 2275 goto scroll_fail_1;
2270 2276
2271 pos = *vmotion (startp, -pos.vpos, w); 2277 pos = *vmotion (startp, -pos.vpos, w);