aboutsummaryrefslogtreecommitdiffstats
path: root/src/scroll.c
diff options
context:
space:
mode:
authorMiles Bader2007-08-29 05:28:10 +0000
committerMiles Bader2007-08-29 05:28:10 +0000
commit8d9cc0b7ea1893059df8788129998e9a71ec07f3 (patch)
tree4caa326ed8de37c8c0a859c7071593362832d37e /src/scroll.c
parentcb5b9015b372175f1fc90cb7ba3f43298c621509 (diff)
parent5142de65ce179e846514ec7355274ab22822a85c (diff)
downloademacs-8d9cc0b7ea1893059df8788129998e9a71ec07f3.tar.gz
emacs-8d9cc0b7ea1893059df8788129998e9a71ec07f3.zip
Merge multi-tty branch
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-866
Diffstat (limited to 'src/scroll.c')
-rw-r--r--src/scroll.c52
1 files changed, 30 insertions, 22 deletions
diff --git a/src/scroll.c b/src/scroll.c
index 48a40fe23d2..5a59c69003e 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -23,12 +23,13 @@ Boston, MA 02110-1301, USA. */
23#include <config.h> 23#include <config.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <string.h> 25#include <string.h>
26#include "termchar.h"
27#include "lisp.h" 26#include "lisp.h"
27#include "termchar.h"
28#include "dispextern.h" 28#include "dispextern.h"
29#include "keyboard.h" 29#include "keyboard.h"
30#include "frame.h" 30#include "frame.h"
31#include "window.h" 31#include "window.h"
32#include "termhooks.h"
32 33
33/* All costs measured in characters. 34/* All costs measured in characters.
34 So no cost can exceed the area of a frame, measured in characters. 35 So no cost can exceed the area of a frame, measured in characters.
@@ -58,10 +59,12 @@ struct matrix_elt
58 unsigned char writecount; 59 unsigned char writecount;
59 }; 60 };
60 61
61static void do_direct_scrolling P_ ((struct glyph_matrix *, 62static void do_direct_scrolling P_ ((struct frame *,
63 struct glyph_matrix *,
62 struct matrix_elt *, 64 struct matrix_elt *,
63 int, int)); 65 int, int));
64static void do_scrolling P_ ((struct glyph_matrix *, 66static void do_scrolling P_ ((struct frame *,
67 struct glyph_matrix *,
65 struct matrix_elt *, 68 struct matrix_elt *,
66 int, int)); 69 int, int));
67 70
@@ -101,7 +104,8 @@ calculate_scrolling (frame, matrix, window_size, lines_below,
101 register struct matrix_elt *p, *p1; 104 register struct matrix_elt *p, *p1;
102 register int cost, cost1; 105 register int cost, cost1;
103 106
104 int lines_moved = window_size + (scroll_region_ok ? 0 : lines_below); 107 int lines_moved = window_size
108 + (FRAME_SCROLL_REGION_OK (frame) ? 0 : lines_below);
105 /* first_insert_cost[I] is the cost of doing the first insert-line 109 /* first_insert_cost[I] is the cost of doing the first insert-line
106 at the i'th line of the lines we are considering, 110 at the i'th line of the lines we are considering,
107 where I is origin 1 (as it is below). */ 111 where I is origin 1 (as it is below). */
@@ -241,7 +245,8 @@ calculate_scrolling (frame, matrix, window_size, lines_below,
241 of lines. */ 245 of lines. */
242 246
243static void 247static void
244do_scrolling (current_matrix, matrix, window_size, unchanged_at_top) 248do_scrolling (frame, current_matrix, matrix, window_size, unchanged_at_top)
249 struct frame *frame;
245 struct glyph_matrix *current_matrix; 250 struct glyph_matrix *current_matrix;
246 struct matrix_elt *matrix; 251 struct matrix_elt *matrix;
247 int window_size; 252 int window_size;
@@ -308,12 +313,12 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
308 /* Set the terminal window, if not done already. */ 313 /* Set the terminal window, if not done already. */
309 if (! terminal_window_p) 314 if (! terminal_window_p)
310 { 315 {
311 set_terminal_window (window_size + unchanged_at_top); 316 set_terminal_window (frame, window_size + unchanged_at_top);
312 terminal_window_p = 1; 317 terminal_window_p = 1;
313 } 318 }
314 319
315 /* Delete lines on the terminal. */ 320 /* Delete lines on the terminal. */
316 ins_del_lines (j + unchanged_at_top, - p->deletecount); 321 ins_del_lines (frame, j + unchanged_at_top, - p->deletecount);
317 } 322 }
318 else 323 else
319 { 324 {
@@ -338,7 +343,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
338 /* Set the terminal window if not yet done. */ 343 /* Set the terminal window if not yet done. */
339 if (!terminal_window_p) 344 if (!terminal_window_p)
340 { 345 {
341 set_terminal_window (window_size + unchanged_at_top); 346 set_terminal_window (frame, window_size + unchanged_at_top);
342 terminal_window_p = 1; 347 terminal_window_p = 1;
343 } 348 }
344 349
@@ -347,7 +352,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
347 --queue; 352 --queue;
348 353
349 /* Do the deletion on the terminal. */ 354 /* Do the deletion on the terminal. */
350 ins_del_lines (queue->pos, queue->count); 355 ins_del_lines (frame, queue->pos, queue->count);
351 356
352 /* All lines in the range deleted become empty in the glyph 357 /* All lines in the range deleted become empty in the glyph
353 matrix. Assign to them glyph rows that are not retained. 358 matrix. Assign to them glyph rows that are not retained.
@@ -380,7 +385,7 @@ do_scrolling (current_matrix, matrix, window_size, unchanged_at_top)
380 CHECK_MATRIX (current_matrix); 385 CHECK_MATRIX (current_matrix);
381 386
382 if (terminal_window_p) 387 if (terminal_window_p)
383 set_terminal_window (0); 388 set_terminal_window (frame, 0);
384} 389}
385 390
386 391
@@ -467,7 +472,8 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below,
467 /* Overhead of setting the scroll window, plus the extra cost 472 /* Overhead of setting the scroll window, plus the extra cost
468 cost of scrolling by a distance of one. The extra cost is 473 cost of scrolling by a distance of one. The extra cost is
469 added once for consistency with the cost vectors */ 474 added once for consistency with the cost vectors */
470 scroll_overhead = scroll_region_cost + extra_cost; 475 scroll_overhead
476 = FRAME_SCROLL_REGION_COST (frame) + extra_cost;
471 477
472 /* initialize the top left corner of the matrix */ 478 /* initialize the top left corner of the matrix */
473 matrix->writecost = 0; 479 matrix->writecost = 0;
@@ -650,8 +656,9 @@ calculate_direct_scrolling (frame, matrix, window_size, lines_below,
650 the cost matrix for this approach is constructed. */ 656 the cost matrix for this approach is constructed. */
651 657
652static void 658static void
653do_direct_scrolling (current_matrix, cost_matrix, window_size, 659do_direct_scrolling (frame, current_matrix, cost_matrix,
654 unchanged_at_top) 660 window_size, unchanged_at_top)
661 struct frame *frame;
655 struct glyph_matrix *current_matrix; 662 struct glyph_matrix *current_matrix;
656 struct matrix_elt *cost_matrix; 663 struct matrix_elt *cost_matrix;
657 int window_size; 664 int window_size;
@@ -742,9 +749,9 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
742 if (i > j) 749 if (i > j)
743 { 750 {
744 /* Immediately insert lines */ 751 /* Immediately insert lines */
745 set_terminal_window (i + unchanged_at_top); 752 set_terminal_window (frame, i + unchanged_at_top);
746 terminal_window_p = 1; 753 terminal_window_p = 1;
747 ins_del_lines (j - n_to_write + unchanged_at_top, i - j); 754 ins_del_lines (frame, j - n_to_write + unchanged_at_top, i - j);
748 } 755 }
749 else if (i < j) 756 else if (i < j)
750 { 757 {
@@ -774,9 +781,9 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
774 --queue; 781 --queue;
775 if (queue->count) 782 if (queue->count)
776 { 783 {
777 set_terminal_window (queue->window); 784 set_terminal_window (frame, queue->window);
778 terminal_window_p = 1; 785 terminal_window_p = 1;
779 ins_del_lines (queue->pos, queue->count); 786 ins_del_lines (frame, queue->pos, queue->count);
780 } 787 }
781 else 788 else
782 { 789 {
@@ -799,7 +806,7 @@ do_direct_scrolling (current_matrix, cost_matrix, window_size,
799 copy_from, retained_p); 806 copy_from, retained_p);
800 807
801 if (terminal_window_p) 808 if (terminal_window_p)
802 set_terminal_window (0); 809 set_terminal_window (frame, 0);
803} 810}
804 811
805 812
@@ -819,13 +826,13 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
819 matrix = ((struct matrix_elt *) 826 matrix = ((struct matrix_elt *)
820 alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix)); 827 alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix));
821 828
822 if (scroll_region_ok) 829 if (FRAME_SCROLL_REGION_OK (frame))
823 { 830 {
824 calculate_direct_scrolling (frame, matrix, window_size, 831 calculate_direct_scrolling (frame, matrix, window_size,
825 unchanged_at_bottom, 832 unchanged_at_bottom,
826 draw_cost, old_draw_cost, 833 draw_cost, old_draw_cost,
827 old_hash, new_hash, free_at_end); 834 old_hash, new_hash, free_at_end);
828 do_direct_scrolling (frame->current_matrix, 835 do_direct_scrolling (frame, frame->current_matrix,
829 matrix, window_size, unchanged_at_top); 836 matrix, window_size, unchanged_at_top);
830 } 837 }
831 else 838 else
@@ -833,7 +840,8 @@ scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom,
833 calculate_scrolling (frame, matrix, window_size, unchanged_at_bottom, 840 calculate_scrolling (frame, matrix, window_size, unchanged_at_bottom,
834 draw_cost, old_hash, new_hash, 841 draw_cost, old_hash, new_hash,
835 free_at_end); 842 free_at_end);
836 do_scrolling (frame->current_matrix, matrix, window_size, 843 do_scrolling (frame,
844 frame->current_matrix, matrix, window_size,
837 unchanged_at_top); 845 unchanged_at_top);
838 } 846 }
839} 847}
@@ -915,7 +923,7 @@ scroll_cost (frame, from, to, amount)
915 if (amount == 0) 923 if (amount == 0)
916 return 0; 924 return 0;
917 925
918 if (! scroll_region_ok) 926 if (! FRAME_SCROLL_REGION_OK (frame))
919 limit = height; 927 limit = height;
920 else if (amount > 0) 928 else if (amount > 0)
921 limit += amount; 929 limit += amount;