diff options
Diffstat (limited to 'src/scroll.c')
-rw-r--r-- | src/scroll.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/scroll.c b/src/scroll.c index 6cbf212f09e..e523a19ab89 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -28,12 +28,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include "frame.h" #include "termhooks.h" -/* All costs measured in characters. - So no cost can exceed the area of a frame, measured in characters. - Let's hope this is never more than 1000000 characters. */ - -#define INFINITY 1000000 - struct matrix_elt { /* Cost of outputting through this line @@ -120,8 +114,8 @@ calculate_scrolling (struct frame *frame, /* initialize the top left corner of the matrix */ matrix->writecost = 0; - matrix->insertcost = INFINITY; - matrix->deletecost = INFINITY; + matrix->insertcost = SCROLL_INFINITY; + matrix->deletecost = SCROLL_INFINITY; matrix->insertcount = 0; matrix->deletecount = 0; @@ -132,8 +126,8 @@ calculate_scrolling (struct frame *frame, p = matrix + i * (window_size + 1); cost += draw_cost[i] + next_insert_cost[i] + extra_cost; p->insertcost = cost; - p->writecost = INFINITY; - p->deletecost = INFINITY; + p->writecost = SCROLL_INFINITY; + p->deletecost = SCROLL_INFINITY; p->insertcount = i; p->deletecount = 0; } @@ -144,8 +138,8 @@ calculate_scrolling (struct frame *frame, { cost += next_delete_cost[j]; matrix[j].deletecost = cost; - matrix[j].writecost = INFINITY; - matrix[j].insertcost = INFINITY; + matrix[j].writecost = SCROLL_INFINITY; + matrix[j].insertcost = SCROLL_INFINITY; matrix[j].deletecount = j; matrix[j].insertcount = 0; } @@ -192,13 +186,13 @@ calculate_scrolling (struct frame *frame, else { cost = p1->writecost + first_insert_cost[i]; - if ((int) p1->insertcount > i) + if (p1->insertcount > i) emacs_abort (); cost1 = p1->insertcost + next_insert_cost[i - p1->insertcount]; } p->insertcost = min (cost, cost1) + draw_cost[i] + extra_cost; p->insertcount = (cost < cost1) ? 1 : p1->insertcount + 1; - if ((int) p->insertcount > i) + if (p->insertcount > i) emacs_abort (); /* Calculate the cost if we do a delete line after @@ -465,8 +459,8 @@ calculate_direct_scrolling (struct frame *frame, /* initialize the top left corner of the matrix */ matrix->writecost = 0; - matrix->insertcost = INFINITY; - matrix->deletecost = INFINITY; + matrix->insertcost = SCROLL_INFINITY; + matrix->deletecost = SCROLL_INFINITY; matrix->writecount = 0; matrix->insertcount = 0; matrix->deletecount = 0; @@ -478,8 +472,8 @@ calculate_direct_scrolling (struct frame *frame, p = matrix + i * (window_size + 1); cost += draw_cost[i]; p->insertcost = cost; - p->writecost = INFINITY; - p->deletecost = INFINITY; + p->writecost = SCROLL_INFINITY; + p->deletecost = SCROLL_INFINITY; p->insertcount = i; p->writecount = 0; p->deletecount = 0; @@ -489,8 +483,8 @@ calculate_direct_scrolling (struct frame *frame, for (j = 1; j <= window_size; j++) { matrix[j].deletecost = 0; - matrix[j].writecost = INFINITY; - matrix[j].insertcost = INFINITY; + matrix[j].writecost = SCROLL_INFINITY; + matrix[j].insertcost = SCROLL_INFINITY; matrix[j].deletecount = j; matrix[j].writecount = 0; matrix[j].insertcount = 0; |