aboutsummaryrefslogtreecommitdiffstats
path: root/src/scroll.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/scroll.c')
-rw-r--r--src/scroll.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/scroll.c b/src/scroll.c
index 9e11feb64d4..3da236ca8a6 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -1,6 +1,6 @@
1/* Calculate what line insertion or deletion to do, and do it 1/* Calculate what line insertion or deletion to do, and do it
2 2
3Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2013 Free Software 3Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2014 Free Software
4Foundation, Inc. 4Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
@@ -86,7 +86,7 @@ static void do_scrolling (struct frame *,
86 new contents appears. */ 86 new contents appears. */
87 87
88static void 88static void
89calculate_scrolling (FRAME_PTR frame, 89calculate_scrolling (struct frame *frame,
90 /* matrix is of size window_size + 1 on each side. */ 90 /* matrix is of size window_size + 1 on each side. */
91 struct matrix_elt *matrix, 91 struct matrix_elt *matrix,
92 int window_size, int lines_below, 92 int window_size, int lines_below,
@@ -246,9 +246,8 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
246 struct matrix_elt *p; 246 struct matrix_elt *p;
247 int i, j, k; 247 int i, j, k;
248 248
249 /* Set to 1 if we have set a terminal window with 249 /* True if we have set a terminal window with set_terminal_window. */
250 set_terminal_window. It's unsigned to work around GCC bug 48228. */ 250 bool terminal_window_p = 0;
251 unsigned int terminal_window_p = 0;
252 251
253 /* A queue for line insertions to be done. */ 252 /* A queue for line insertions to be done. */
254 struct queue { int count, pos; }; 253 struct queue { int count, pos; };
@@ -423,7 +422,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
423 is the equivalent of draw_cost for the old line contents */ 422 is the equivalent of draw_cost for the old line contents */
424 423
425static void 424static void
426calculate_direct_scrolling (FRAME_PTR frame, 425calculate_direct_scrolling (struct frame *frame,
427 /* matrix is of size window_size + 1 on each side. */ 426 /* matrix is of size window_size + 1 on each side. */
428 struct matrix_elt *matrix, 427 struct matrix_elt *matrix,
429 int window_size, int lines_below, 428 int window_size, int lines_below,
@@ -653,22 +652,19 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
653 652
654 /* A queue of deletions and insertions to be performed. */ 653 /* A queue of deletions and insertions to be performed. */
655 struct alt_queue { int count, pos, window; }; 654 struct alt_queue { int count, pos, window; };
656 struct alt_queue *queue_start = (struct alt_queue *) 655 struct alt_queue *queue_start = alloca (window_size * sizeof *queue_start);
657 alloca (window_size * sizeof *queue_start);
658 struct alt_queue *queue = queue_start; 656 struct alt_queue *queue = queue_start;
659 657
660 /* Set to 1 if a terminal window has been set with 658 /* True if a terminal window has been set with set_terminal_window. */
661 set_terminal_window: */ 659 bool terminal_window_p = 0;
662 int terminal_window_p = 0;
663 660
664 /* A nonzero value of write_follows indicates that a write has been 661 /* If true, a write has been selected, allowing either an insert or a
665 selected, allowing either an insert or a delete to be selected 662 delete to be selected next. If false, a delete cannot be selected
666 next. When write_follows is zero, a delete cannot be selected
667 unless j < i, and an insert cannot be selected unless i < j. 663 unless j < i, and an insert cannot be selected unless i < j.
668 This corresponds to a similar restriction (with the ordering 664 This corresponds to a similar restriction (with the ordering
669 reversed) in calculate_direct_scrolling, which is intended to 665 reversed) in calculate_direct_scrolling, which is intended to
670 ensure that lines marked as inserted will be blank. */ 666 ensure that lines marked as inserted will be blank. */
671 int write_follows_p = 1; 667 bool write_follows_p = 1;
672 668
673 /* For each row in the new matrix what row of the old matrix it is. */ 669 /* For each row in the new matrix what row of the old matrix it is. */
674 int *copy_from = alloca (window_size * sizeof *copy_from); 670 int *copy_from = alloca (window_size * sizeof *copy_from);
@@ -796,13 +792,12 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
796 792
797 793
798void 794void
799scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top, 795scrolling_1 (struct frame *frame, int window_size, int unchanged_at_top,
800 int unchanged_at_bottom, int *draw_cost, int *old_draw_cost, 796 int unchanged_at_bottom, int *draw_cost, int *old_draw_cost,
801 int *old_hash, int *new_hash, int free_at_end) 797 int *old_hash, int *new_hash, int free_at_end)
802{ 798{
803 struct matrix_elt *matrix; 799 struct matrix_elt *matrix
804 matrix = ((struct matrix_elt *) 800 = alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix);
805 alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix));
806 801
807 if (FRAME_SCROLL_REGION_OK (frame)) 802 if (FRAME_SCROLL_REGION_OK (frame))
808 { 803 {
@@ -886,7 +881,7 @@ scrolling_max_lines_saved (int start, int end,
886 overhead and multiply factor values */ 881 overhead and multiply factor values */
887 882
888static void 883static void
889line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, 884line_ins_del (struct frame *frame, int ov1, int pf1, int ovn, int pfn,
890 register int *ov, register int *mf) 885 register int *ov, register int *mf)
891{ 886{
892 register int i; 887 register int i;
@@ -904,7 +899,7 @@ line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
904} 899}
905 900
906static void 901static void
907ins_del_costs (FRAME_PTR frame, 902ins_del_costs (struct frame *frame,
908 const char *one_line_string, const char *multi_string, 903 const char *one_line_string, const char *multi_string,
909 const char *setup_string, const char *cleanup_string, 904 const char *setup_string, const char *cleanup_string,
910 int *costvec, int *ncostvec, 905 int *costvec, int *ncostvec,
@@ -960,7 +955,7 @@ ins_del_costs (FRAME_PTR frame,
960 */ 955 */
961 956
962void 957void
963do_line_insertion_deletion_costs (FRAME_PTR frame, 958do_line_insertion_deletion_costs (struct frame *frame,
964 const char *ins_line_string, 959 const char *ins_line_string,
965 const char *multi_ins_string, 960 const char *multi_ins_string,
966 const char *del_line_string, 961 const char *del_line_string,