aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorEli Zaretskii2015-02-09 18:24:46 +0200
committerEli Zaretskii2015-02-09 18:24:46 +0200
commit403cb178c75a80603dbd8ed23e342d2109645401 (patch)
tree815315bef8212ed239805f13089612ebcef78a82 /src/window.c
parentaf560cd6f15e7cc7e42bff5b3c802b9d1d1640b5 (diff)
downloademacs-403cb178c75a80603dbd8ed23e342d2109645401.tar.gz
emacs-403cb178c75a80603dbd8ed23e342d2109645401.zip
Speed up vertical-motion when screen coordinates are known
src/indent.c (Fvertical_motion): Accept an additional argument CUR-COL and use it as the starting screen coordinate. src/window.c (window_scroll_line_based, Fmove_to_window_line): All callers of vertical-motion changed. doc/lispref/positions.texi (Screen Lines): Update the documentation of vertical-motion to document the new additional argument.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/window.c b/src/window.c
index 293140041a9..d59616d0545 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5350,14 +5350,14 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror)
5350 5350
5351 if (NILP (tem)) 5351 if (NILP (tem))
5352 { 5352 {
5353 Fvertical_motion (make_number (- (ht / 2)), window); 5353 Fvertical_motion (make_number (- (ht / 2)), window, Qnil);
5354 startpos = PT; 5354 startpos = PT;
5355 startbyte = PT_BYTE; 5355 startbyte = PT_BYTE;
5356 } 5356 }
5357 5357
5358 SET_PT_BOTH (startpos, startbyte); 5358 SET_PT_BOTH (startpos, startbyte);
5359 lose = n < 0 && PT == BEGV; 5359 lose = n < 0 && PT == BEGV;
5360 Fvertical_motion (make_number (n), window); 5360 Fvertical_motion (make_number (n), window, Qnil);
5361 pos = PT; 5361 pos = PT;
5362 pos_byte = PT_BYTE; 5362 pos_byte = PT_BYTE;
5363 bolp = Fbolp (); 5363 bolp = Fbolp ();
@@ -5389,7 +5389,7 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror)
5389 && (whole || !EQ (Vscroll_preserve_screen_position, Qt))) 5389 && (whole || !EQ (Vscroll_preserve_screen_position, Qt)))
5390 { 5390 {
5391 SET_PT_BOTH (pos, pos_byte); 5391 SET_PT_BOTH (pos, pos_byte);
5392 Fvertical_motion (original_pos, window); 5392 Fvertical_motion (original_pos, window, Qnil);
5393 } 5393 }
5394 /* If we scrolled forward, put point enough lines down 5394 /* If we scrolled forward, put point enough lines down
5395 that it is outside the scroll margin. */ 5395 that it is outside the scroll margin. */
@@ -5400,7 +5400,7 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror)
5400 if (this_scroll_margin > 0) 5400 if (this_scroll_margin > 0)
5401 { 5401 {
5402 SET_PT_BOTH (pos, pos_byte); 5402 SET_PT_BOTH (pos, pos_byte);
5403 Fvertical_motion (make_number (this_scroll_margin), window); 5403 Fvertical_motion (make_number (this_scroll_margin), window, Qnil);
5404 top_margin = PT; 5404 top_margin = PT;
5405 } 5405 }
5406 else 5406 else
@@ -5412,7 +5412,7 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror)
5412 else if (!NILP (Vscroll_preserve_screen_position)) 5412 else if (!NILP (Vscroll_preserve_screen_position))
5413 { 5413 {
5414 SET_PT_BOTH (pos, pos_byte); 5414 SET_PT_BOTH (pos, pos_byte);
5415 Fvertical_motion (original_pos, window); 5415 Fvertical_motion (original_pos, window, Qnil);
5416 } 5416 }
5417 else 5417 else
5418 SET_PT (top_margin); 5418 SET_PT (top_margin);
@@ -5424,7 +5424,8 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror)
5424 /* If we scrolled backward, put point near the end of the window 5424 /* If we scrolled backward, put point near the end of the window
5425 but not within the scroll margin. */ 5425 but not within the scroll margin. */
5426 SET_PT_BOTH (pos, pos_byte); 5426 SET_PT_BOTH (pos, pos_byte);
5427 tem = Fvertical_motion (make_number (ht - this_scroll_margin), window); 5427 tem = Fvertical_motion (make_number (ht - this_scroll_margin), window,
5428 Qnil);
5428 if (XFASTINT (tem) == ht - this_scroll_margin) 5429 if (XFASTINT (tem) == ht - this_scroll_margin)
5429 bottom_margin = PT; 5430 bottom_margin = PT;
5430 else 5431 else
@@ -5438,10 +5439,10 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror)
5438 if (!NILP (Vscroll_preserve_screen_position)) 5439 if (!NILP (Vscroll_preserve_screen_position))
5439 { 5440 {
5440 SET_PT_BOTH (pos, pos_byte); 5441 SET_PT_BOTH (pos, pos_byte);
5441 Fvertical_motion (original_pos, window); 5442 Fvertical_motion (original_pos, window, Qnil);
5442 } 5443 }
5443 else 5444 else
5444 Fvertical_motion (make_number (-1), window); 5445 Fvertical_motion (make_number (-1), window, Qnil);
5445 } 5446 }
5446 } 5447 }
5447 } 5448 }
@@ -5999,7 +6000,7 @@ zero means top of window, negative means relative to bottom of window. */)
5999 if (start < BEGV || start > ZV) 6000 if (start < BEGV || start > ZV)
6000 { 6001 {
6001 int height = window_internal_height (w); 6002 int height = window_internal_height (w);
6002 Fvertical_motion (make_number (- (height / 2)), window); 6003 Fvertical_motion (make_number (- (height / 2)), window, Qnil);
6003 set_marker_both (w->start, w->contents, PT, PT_BYTE); 6004 set_marker_both (w->start, w->contents, PT, PT_BYTE);
6004 w->start_at_line_beg = !NILP (Fbolp ()); 6005 w->start_at_line_beg = !NILP (Fbolp ());
6005 w->force_start = 1; 6006 w->force_start = 1;
@@ -6040,7 +6041,7 @@ zero means top of window, negative means relative to bottom of window. */)
6040 if (w->vscroll) 6041 if (w->vscroll)
6041 XSETINT (arg, XINT (arg) + 1); 6042 XSETINT (arg, XINT (arg) + 1);
6042 6043
6043 return Fvertical_motion (arg, window); 6044 return Fvertical_motion (arg, window, Qnil);
6044} 6045}
6045 6046
6046 6047