1
1
/* Calculate what line insertion or deletion to do, and do it
3
Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2013 Free Software
3
Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2014 Free Software
6
6
This file is part of GNU Emacs.
86
86
new contents appears. */
89
calculate_scrolling (FRAME_PTR frame,
89
calculate_scrolling (struct frame *frame,
90
90
/* matrix is of size window_size + 1 on each side. */
91
91
struct matrix_elt *matrix,
92
92
int window_size, int lines_below,
246
246
struct matrix_elt *p;
249
/* Set to 1 if we have set a terminal window with
250
set_terminal_window. It's unsigned to work around GCC bug 48228. */
251
unsigned int terminal_window_p = 0;
249
/* True if we have set a terminal window with set_terminal_window. */
250
bool terminal_window_p = 0;
253
252
/* A queue for line insertions to be done. */
254
253
struct queue { int count, pos; };
423
422
is the equivalent of draw_cost for the old line contents */
426
calculate_direct_scrolling (FRAME_PTR frame,
425
calculate_direct_scrolling (struct frame *frame,
427
426
/* matrix is of size window_size + 1 on each side. */
428
427
struct matrix_elt *matrix,
429
428
int window_size, int lines_below,
654
653
/* A queue of deletions and insertions to be performed. */
655
654
struct alt_queue { int count, pos, window; };
656
struct alt_queue *queue_start = (struct alt_queue *)
657
alloca (window_size * sizeof *queue_start);
655
struct alt_queue *queue_start = alloca (window_size * sizeof *queue_start);
658
656
struct alt_queue *queue = queue_start;
660
/* Set to 1 if a terminal window has been set with
661
set_terminal_window: */
662
int terminal_window_p = 0;
658
/* True if a terminal window has been set with set_terminal_window. */
659
bool terminal_window_p = 0;
664
/* A nonzero value of write_follows indicates that a write has been
665
selected, allowing either an insert or a delete to be selected
666
next. When write_follows is zero, a delete cannot be selected
661
/* If true, a write has been selected, allowing either an insert or a
662
delete to be selected next. If false, a delete cannot be selected
667
663
unless j < i, and an insert cannot be selected unless i < j.
668
664
This corresponds to a similar restriction (with the ordering
669
665
reversed) in calculate_direct_scrolling, which is intended to
670
666
ensure that lines marked as inserted will be blank. */
671
int write_follows_p = 1;
667
bool write_follows_p = 1;
673
669
/* For each row in the new matrix what row of the old matrix it is. */
674
670
int *copy_from = alloca (window_size * sizeof *copy_from);
799
scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top,
795
scrolling_1 (struct frame *frame, int window_size, int unchanged_at_top,
800
796
int unchanged_at_bottom, int *draw_cost, int *old_draw_cost,
801
797
int *old_hash, int *new_hash, int free_at_end)
803
struct matrix_elt *matrix;
804
matrix = ((struct matrix_elt *)
805
alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix));
799
struct matrix_elt *matrix
800
= alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix);
807
802
if (FRAME_SCROLL_REGION_OK (frame))
886
881
overhead and multiply factor values */
889
line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
884
line_ins_del (struct frame *frame, int ov1, int pf1, int ovn, int pfn,
890
885
register int *ov, register int *mf)
907
ins_del_costs (FRAME_PTR frame,
902
ins_del_costs (struct frame *frame,
908
903
const char *one_line_string, const char *multi_string,
909
904
const char *setup_string, const char *cleanup_string,
910
905
int *costvec, int *ncostvec,
963
do_line_insertion_deletion_costs (FRAME_PTR frame,
958
do_line_insertion_deletion_costs (struct frame *frame,
964
959
const char *ins_line_string,
965
960
const char *multi_ins_string,
966
961
const char *del_line_string,