diff options
| author | Jim Blandy | 1992-07-13 20:56:17 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-07-13 20:56:17 +0000 |
| commit | 0137dbf747e9fcbfe6f37c7fb0bbb29012a27179 (patch) | |
| tree | 658380474eae580fc6b03b724e6498d9cf0b783f /src/scroll.c | |
| parent | ff11dfa15b3b56559bac0d5c6b0a26a80d2d5f6d (diff) | |
| download | emacs-0137dbf747e9fcbfe6f37c7fb0bbb29012a27179.tar.gz emacs-0137dbf747e9fcbfe6f37c7fb0bbb29012a27179.zip | |
entered into RCS
Diffstat (limited to 'src/scroll.c')
| -rw-r--r-- | src/scroll.c | 230 |
1 files changed, 115 insertions, 115 deletions
diff --git a/src/scroll.c b/src/scroll.c index ed45318a26b..cc743ea0d59 100644 --- a/src/scroll.c +++ b/src/scroll.c | |||
| @@ -22,7 +22,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 22 | #include "termchar.h" | 22 | #include "termchar.h" |
| 23 | #include "lisp.h" | 23 | #include "lisp.h" |
| 24 | #include "dispextern.h" | 24 | #include "dispextern.h" |
| 25 | #include "screen.h" | 25 | #include "frame.h" |
| 26 | 26 | ||
| 27 | extern struct display_line **ophys_lines; | 27 | extern struct display_line **ophys_lines; |
| 28 | 28 | ||
| @@ -30,7 +30,7 @@ extern struct display_line **ophys_lines; | |||
| 30 | #define min(a, b) ((a) < (b) ? (a) : (b)) | 30 | #define min(a, b) ((a) < (b) ? (a) : (b)) |
| 31 | 31 | ||
| 32 | /* All costs measured in characters. | 32 | /* All costs measured in characters. |
| 33 | So no cost can exceed the area of a screen, measured in characters. | 33 | So no cost can exceed the area of a frame, measured in characters. |
| 34 | Let's hope this is never more than 15000 characters. */ | 34 | Let's hope this is never more than 15000 characters. */ |
| 35 | 35 | ||
| 36 | #define INFINITY 15000 | 36 | #define INFINITY 15000 |
| @@ -68,15 +68,15 @@ struct matrix_elt | |||
| 68 | /* draw_cost[VPOS] is the cost of outputting new line at VPOS. | 68 | /* draw_cost[VPOS] is the cost of outputting new line at VPOS. |
| 69 | old_hash[VPOS] is the hash code of the old line at VPOS. | 69 | old_hash[VPOS] is the hash code of the old line at VPOS. |
| 70 | new_hash[VPOS] is the hash code of the new line at VPOS. | 70 | new_hash[VPOS] is the hash code of the new line at VPOS. |
| 71 | Note that these are not true screen vpos's, but relative | 71 | Note that these are not true frame vpos's, but relative |
| 72 | to the place at which the first mismatch between old and | 72 | to the place at which the first mismatch between old and |
| 73 | new contents appears. */ | 73 | new contents appears. */ |
| 74 | 74 | ||
| 75 | static void | 75 | static void |
| 76 | calculate_scrolling (screen, matrix, window_size, lines_below, | 76 | calculate_scrolling (frame, matrix, window_size, lines_below, |
| 77 | draw_cost, old_hash, new_hash, | 77 | draw_cost, old_hash, new_hash, |
| 78 | free_at_end) | 78 | free_at_end) |
| 79 | SCREEN_PTR screen; | 79 | FRAME_PTR frame; |
| 80 | /* matrix is of size window_size + 1 on each side. */ | 80 | /* matrix is of size window_size + 1 on each side. */ |
| 81 | struct matrix_elt *matrix; | 81 | struct matrix_elt *matrix; |
| 82 | int window_size; | 82 | int window_size; |
| @@ -86,7 +86,7 @@ calculate_scrolling (screen, matrix, window_size, lines_below, | |||
| 86 | int free_at_end; | 86 | int free_at_end; |
| 87 | { | 87 | { |
| 88 | register int i, j; | 88 | register int i, j; |
| 89 | int screen_height = SCREEN_HEIGHT (screen); | 89 | int frame_height = FRAME_HEIGHT (frame); |
| 90 | register struct matrix_elt *p, *p1; | 90 | register struct matrix_elt *p, *p1; |
| 91 | register int cost, cost1; | 91 | register int cost, cost1; |
| 92 | 92 | ||
| @@ -95,18 +95,18 @@ calculate_scrolling (screen, matrix, window_size, lines_below, | |||
| 95 | at the I'th line of the lines we are considering, | 95 | at the I'th line of the lines we are considering, |
| 96 | where I is origin 1 (as it is below). */ | 96 | where I is origin 1 (as it is below). */ |
| 97 | int *first_insert_cost | 97 | int *first_insert_cost |
| 98 | = &SCREEN_INSERT_COST (screen)[screen_height - 1 - lines_moved]; | 98 | = &FRAME_INSERT_COST (frame)[frame_height - 1 - lines_moved]; |
| 99 | int *first_delete_cost | 99 | int *first_delete_cost |
| 100 | = &SCREEN_DELETE_COST (screen)[screen_height - 1 - lines_moved]; | 100 | = &FRAME_DELETE_COST (frame)[frame_height - 1 - lines_moved]; |
| 101 | int *next_insert_cost | 101 | int *next_insert_cost |
| 102 | = &SCREEN_INSERTN_COST (screen)[screen_height - 1 - lines_moved]; | 102 | = &FRAME_INSERTN_COST (frame)[frame_height - 1 - lines_moved]; |
| 103 | int *next_delete_cost | 103 | int *next_delete_cost |
| 104 | = &SCREEN_DELETEN_COST (screen)[screen_height - 1 - lines_moved]; | 104 | = &FRAME_DELETEN_COST (frame)[frame_height - 1 - lines_moved]; |
| 105 | 105 | ||
| 106 | /* Discourage long scrolls on fast lines. | 106 | /* Discourage long scrolls on fast lines. |
| 107 | Don't scroll nearly a full screen height unless it saves | 107 | Don't scroll nearly a full frame height unless it saves |
| 108 | at least 1/4 second. */ | 108 | at least 1/4 second. */ |
| 109 | int extra_cost = baud_rate / (10 * 4 * SCREEN_HEIGHT (screen)); | 109 | int extra_cost = baud_rate / (10 * 4 * FRAME_HEIGHT (frame)); |
| 110 | 110 | ||
| 111 | /* initialize the top left corner of the matrix */ | 111 | /* initialize the top left corner of the matrix */ |
| 112 | matrix->writecost = 0; | 112 | matrix->writecost = 0; |
| @@ -140,8 +140,8 @@ calculate_scrolling (screen, matrix, window_size, lines_below, | |||
| 140 | matrix[j].insertcount = 0; | 140 | matrix[j].insertcount = 0; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | /* `i' represents the vpos among new screen contents. | 143 | /* `i' represents the vpos among new frame contents. |
| 144 | `j' represents the vpos among the old screen contents. */ | 144 | `j' represents the vpos among the old frame contents. */ |
| 145 | p = matrix + window_size + 2; /* matrix [1, 1] */ | 145 | p = matrix + window_size + 2; /* matrix [1, 1] */ |
| 146 | for (i = 1; i <= window_size; i++, p++) | 146 | for (i = 1; i <= window_size; i++, p++) |
| 147 | for (j = 1; j <= window_size; j++, p++) | 147 | for (j = 1; j <= window_size; j++, p++) |
| @@ -216,20 +216,20 @@ calculate_scrolling (screen, matrix, window_size, lines_below, | |||
| 216 | 216 | ||
| 217 | /* Perform insert-lines and delete-lines operations | 217 | /* Perform insert-lines and delete-lines operations |
| 218 | according to the costs in the matrix. | 218 | according to the costs in the matrix. |
| 219 | Updates the contents of the screen to record what was done. */ | 219 | Updates the contents of the frame to record what was done. */ |
| 220 | 220 | ||
| 221 | static void | 221 | static void |
| 222 | do_scrolling (screen, matrix, window_size, unchanged_at_top) | 222 | do_scrolling (frame, matrix, window_size, unchanged_at_top) |
| 223 | SCREEN_PTR screen; | 223 | FRAME_PTR frame; |
| 224 | struct matrix_elt *matrix; | 224 | struct matrix_elt *matrix; |
| 225 | int window_size; | 225 | int window_size; |
| 226 | int unchanged_at_top; | 226 | int unchanged_at_top; |
| 227 | { | 227 | { |
| 228 | register struct matrix_elt *p; | 228 | register struct matrix_elt *p; |
| 229 | register int i, j; | 229 | register int i, j; |
| 230 | register struct screen_glyphs *current_screen; | 230 | register struct frame_glyphs *current_frame; |
| 231 | /* temp_screen->enable[i] means line i has been moved to current_screen. */ | 231 | /* temp_frame->enable[i] means line i has been moved to current_frame. */ |
| 232 | register struct screen_glyphs *temp_screen; | 232 | register struct frame_glyphs *temp_frame; |
| 233 | struct queue { int count, pos; } *queue; | 233 | struct queue { int count, pos; } *queue; |
| 234 | int offset = unchanged_at_top; | 234 | int offset = unchanged_at_top; |
| 235 | int qi = 0; | 235 | int qi = 0; |
| @@ -237,37 +237,37 @@ do_scrolling (screen, matrix, window_size, unchanged_at_top) | |||
| 237 | register int tem; | 237 | register int tem; |
| 238 | int next; | 238 | int next; |
| 239 | 239 | ||
| 240 | queue = (struct queue *) alloca (SCREEN_HEIGHT (screen) | 240 | queue = (struct queue *) alloca (FRAME_HEIGHT (frame) |
| 241 | * sizeof (struct queue)); | 241 | * sizeof (struct queue)); |
| 242 | 242 | ||
| 243 | current_screen = SCREEN_CURRENT_GLYPHS (screen); | 243 | current_frame = FRAME_CURRENT_GLYPHS (frame); |
| 244 | temp_screen = SCREEN_TEMP_GLYPHS (screen); | 244 | temp_frame = FRAME_TEMP_GLYPHS (frame); |
| 245 | 245 | ||
| 246 | bcopy (current_screen->glyphs, temp_screen->glyphs, | 246 | bcopy (current_frame->glyphs, temp_frame->glyphs, |
| 247 | current_screen->height * sizeof (GLYPH *)); | 247 | current_frame->height * sizeof (GLYPH *)); |
| 248 | bcopy (current_screen->used, temp_screen->used, | 248 | bcopy (current_frame->used, temp_frame->used, |
| 249 | current_screen->height * sizeof (int)); | 249 | current_frame->height * sizeof (int)); |
| 250 | bcopy (current_screen->highlight, temp_screen->highlight, | 250 | bcopy (current_frame->highlight, temp_frame->highlight, |
| 251 | current_screen->height * sizeof (char)); | 251 | current_frame->height * sizeof (char)); |
| 252 | bzero (temp_screen->enable, temp_screen->height * sizeof (char)); | 252 | bzero (temp_frame->enable, temp_frame->height * sizeof (char)); |
| 253 | bcopy (current_screen->bufp, temp_screen->bufp, | 253 | bcopy (current_frame->bufp, temp_frame->bufp, |
| 254 | current_screen->height * sizeof (int)); | 254 | current_frame->height * sizeof (int)); |
| 255 | 255 | ||
| 256 | #ifdef HAVE_X_WINDOWS | 256 | #ifdef HAVE_X_WINDOWS |
| 257 | if (SCREEN_IS_X (screen)) | 257 | if (FRAME_IS_X (frame)) |
| 258 | { | 258 | { |
| 259 | bcopy (current_screen->nruns, temp_screen->nruns, | 259 | bcopy (current_frame->nruns, temp_frame->nruns, |
| 260 | current_screen->height * sizeof (int)); | 260 | current_frame->height * sizeof (int)); |
| 261 | bcopy (current_screen->face_list, temp_screen->face_list, | 261 | bcopy (current_frame->face_list, temp_frame->face_list, |
| 262 | current_screen->height * sizeof (struct run *)); | 262 | current_frame->height * sizeof (struct run *)); |
| 263 | bcopy (current_screen->top_left_x, temp_screen->top_left_x, | 263 | bcopy (current_frame->top_left_x, temp_frame->top_left_x, |
| 264 | current_screen->height * sizeof (short)); | 264 | current_frame->height * sizeof (short)); |
| 265 | bcopy (current_screen->top_left_y, temp_screen->top_left_y, | 265 | bcopy (current_frame->top_left_y, temp_frame->top_left_y, |
| 266 | current_screen->height * sizeof (short)); | 266 | current_frame->height * sizeof (short)); |
| 267 | bcopy (current_screen->pix_width, temp_screen->pix_width, | 267 | bcopy (current_frame->pix_width, temp_frame->pix_width, |
| 268 | current_screen->height * sizeof (short)); | 268 | current_frame->height * sizeof (short)); |
| 269 | bcopy (current_screen->pix_height, temp_screen->pix_height, | 269 | bcopy (current_frame->pix_height, temp_frame->pix_height, |
| 270 | current_screen->height * sizeof (short)); | 270 | current_frame->height * sizeof (short)); |
| 271 | } | 271 | } |
| 272 | #endif | 272 | #endif |
| 273 | 273 | ||
| @@ -300,14 +300,14 @@ do_scrolling (screen, matrix, window_size, unchanged_at_top) | |||
| 300 | { | 300 | { |
| 301 | /* Best thing done here is no insert or delete */ | 301 | /* Best thing done here is no insert or delete */ |
| 302 | /* Old line at vpos j-1 ends up at vpos i-1 */ | 302 | /* Old line at vpos j-1 ends up at vpos i-1 */ |
| 303 | current_screen->glyphs[i + offset - 1] | 303 | current_frame->glyphs[i + offset - 1] |
| 304 | = temp_screen->glyphs[j + offset - 1]; | 304 | = temp_frame->glyphs[j + offset - 1]; |
| 305 | current_screen->used[i + offset - 1] | 305 | current_frame->used[i + offset - 1] |
| 306 | = temp_screen->used[j + offset - 1]; | 306 | = temp_frame->used[j + offset - 1]; |
| 307 | current_screen->highlight[i + offset - 1] | 307 | current_frame->highlight[i + offset - 1] |
| 308 | = temp_screen->highlight[j + offset - 1]; | 308 | = temp_frame->highlight[j + offset - 1]; |
| 309 | 309 | ||
| 310 | temp_screen->enable[j + offset - 1] = 1; | 310 | temp_frame->enable[j + offset - 1] = 1; |
| 311 | i--; | 311 | i--; |
| 312 | j--; | 312 | j--; |
| 313 | } | 313 | } |
| @@ -329,14 +329,14 @@ do_scrolling (screen, matrix, window_size, unchanged_at_top) | |||
| 329 | /* Mark the inserted lines as clear, | 329 | /* Mark the inserted lines as clear, |
| 330 | and put into them the line-contents strings | 330 | and put into them the line-contents strings |
| 331 | that were discarded during the deletions. | 331 | that were discarded during the deletions. |
| 332 | Those are the ones for which temp_screen->enable was not set. */ | 332 | Those are the ones for which temp_frame->enable was not set. */ |
| 333 | tem = queue[i].pos; | 333 | tem = queue[i].pos; |
| 334 | for (j = tem + queue[i].count - 1; j >= tem; j--) | 334 | for (j = tem + queue[i].count - 1; j >= tem; j--) |
| 335 | { | 335 | { |
| 336 | current_screen->enable[j] = 0; | 336 | current_frame->enable[j] = 0; |
| 337 | while (temp_screen->enable[next]) | 337 | while (temp_frame->enable[next]) |
| 338 | next++; | 338 | next++; |
| 339 | current_screen->glyphs[j] = temp_screen->glyphs[next++]; | 339 | current_frame->glyphs[j] = temp_frame->glyphs[next++]; |
| 340 | } | 340 | } |
| 341 | } | 341 | } |
| 342 | 342 | ||
| @@ -345,9 +345,9 @@ do_scrolling (screen, matrix, window_size, unchanged_at_top) | |||
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | void | 347 | void |
| 348 | scrolling_1 (screen, window_size, unchanged_at_top, unchanged_at_bottom, | 348 | scrolling_1 (frame, window_size, unchanged_at_top, unchanged_at_bottom, |
| 349 | draw_cost, old_hash, new_hash, free_at_end) | 349 | draw_cost, old_hash, new_hash, free_at_end) |
| 350 | SCREEN_PTR screen; | 350 | FRAME_PTR frame; |
| 351 | int window_size, unchanged_at_top, unchanged_at_bottom; | 351 | int window_size, unchanged_at_top, unchanged_at_bottom; |
| 352 | int *draw_cost; | 352 | int *draw_cost; |
| 353 | int *old_hash; | 353 | int *old_hash; |
| @@ -358,13 +358,13 @@ scrolling_1 (screen, window_size, unchanged_at_top, unchanged_at_bottom, | |||
| 358 | matrix = ((struct matrix_elt *) | 358 | matrix = ((struct matrix_elt *) |
| 359 | alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix)); | 359 | alloca ((window_size + 1) * (window_size + 1) * sizeof *matrix)); |
| 360 | 360 | ||
| 361 | calculate_scrolling (screen, matrix, window_size, unchanged_at_bottom, | 361 | calculate_scrolling (frame, matrix, window_size, unchanged_at_bottom, |
| 362 | draw_cost, old_hash, new_hash, | 362 | draw_cost, old_hash, new_hash, |
| 363 | free_at_end); | 363 | free_at_end); |
| 364 | do_scrolling (screen, matrix, window_size, unchanged_at_top); | 364 | do_scrolling (frame, matrix, window_size, unchanged_at_top); |
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | /* Return number of lines in common between current and desired screen contents | 367 | /* Return number of lines in common between current and desired frame contents |
| 368 | described to us only as vectors of hash codes OLDHASH and NEWHASH. | 368 | described to us only as vectors of hash codes OLDHASH and NEWHASH. |
| 369 | Consider only vpos range START to END (not including END). | 369 | Consider only vpos range START to END (not including END). |
| 370 | Ignore short lines on the assumption that | 370 | Ignore short lines on the assumption that |
| @@ -427,17 +427,17 @@ scrolling_max_lines_saved (start, end, oldhash, newhash, cost) | |||
| 427 | starting with vpos FROM, up to but not including vpos TO, | 427 | starting with vpos FROM, up to but not including vpos TO, |
| 428 | down by AMOUNT lines (AMOUNT may be negative). | 428 | down by AMOUNT lines (AMOUNT may be negative). |
| 429 | These are the same arguments that might be given to | 429 | These are the same arguments that might be given to |
| 430 | scroll_screen_lines to perform this scrolling. */ | 430 | scroll_frame_lines to perform this scrolling. */ |
| 431 | 431 | ||
| 432 | scroll_cost (screen, from, to, amount) | 432 | scroll_cost (frame, from, to, amount) |
| 433 | SCREEN_PTR screen; | 433 | FRAME_PTR frame; |
| 434 | int from, to, amount; | 434 | int from, to, amount; |
| 435 | { | 435 | { |
| 436 | /* Compute how many lines, at bottom of screen, | 436 | /* Compute how many lines, at bottom of frame, |
| 437 | will not be involved in actual motion. */ | 437 | will not be involved in actual motion. */ |
| 438 | int limit = to; | 438 | int limit = to; |
| 439 | int offset; | 439 | int offset; |
| 440 | int height = SCREEN_HEIGHT (screen); | 440 | int height = FRAME_HEIGHT (frame); |
| 441 | 441 | ||
| 442 | if (amount == 0) | 442 | if (amount == 0) |
| 443 | return 0; | 443 | return 0; |
| @@ -458,28 +458,28 @@ scroll_cost (screen, from, to, amount) | |||
| 458 | offset = height - limit; | 458 | offset = height - limit; |
| 459 | 459 | ||
| 460 | return | 460 | return |
| 461 | (SCREEN_INSERT_COST (screen)[offset + from] | 461 | (FRAME_INSERT_COST (frame)[offset + from] |
| 462 | + (amount - 1) * SCREEN_INSERTN_COST (screen)[offset + from] | 462 | + (amount - 1) * FRAME_INSERTN_COST (frame)[offset + from] |
| 463 | + SCREEN_DELETEN_COST (screen)[offset + to] | 463 | + FRAME_DELETEN_COST (frame)[offset + to] |
| 464 | + (amount - 1) * SCREEN_DELETE_COST (screen)[offset + to]); | 464 | + (amount - 1) * FRAME_DELETE_COST (frame)[offset + to]); |
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | /* Calculate the line insertion/deletion | 467 | /* Calculate the line insertion/deletion |
| 468 | overhead and multiply factor values */ | 468 | overhead and multiply factor values */ |
| 469 | 469 | ||
| 470 | static void | 470 | static void |
| 471 | line_ins_del (screen, ov1, pf1, ovn, pfn, ov, mf) | 471 | line_ins_del (frame, ov1, pf1, ovn, pfn, ov, mf) |
| 472 | SCREEN_PTR screen; | 472 | FRAME_PTR frame; |
| 473 | int ov1, ovn; | 473 | int ov1, ovn; |
| 474 | int pf1, pfn; | 474 | int pf1, pfn; |
| 475 | register int *ov, *mf; | 475 | register int *ov, *mf; |
| 476 | { | 476 | { |
| 477 | register int i; | 477 | register int i; |
| 478 | register int screen_height = SCREEN_HEIGHT (screen); | 478 | register int frame_height = FRAME_HEIGHT (frame); |
| 479 | register int insert_overhead = ov1 * 10; | 479 | register int insert_overhead = ov1 * 10; |
| 480 | register int next_insert_cost = ovn * 10; | 480 | register int next_insert_cost = ovn * 10; |
| 481 | 481 | ||
| 482 | for (i = screen_height-1; i >= 0; i--) | 482 | for (i = frame_height-1; i >= 0; i--) |
| 483 | { | 483 | { |
| 484 | mf[i] = next_insert_cost / 10; | 484 | mf[i] = next_insert_cost / 10; |
| 485 | next_insert_cost += pfn; | 485 | next_insert_cost += pfn; |
| @@ -489,29 +489,29 @@ line_ins_del (screen, ov1, pf1, ovn, pfn, ov, mf) | |||
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | static void | 491 | static void |
| 492 | ins_del_costs (screen, | 492 | ins_del_costs (frame, |
| 493 | one_line_string, multi_string, | 493 | one_line_string, multi_string, |
| 494 | setup_string, cleanup_string, | 494 | setup_string, cleanup_string, |
| 495 | costvec, ncostvec, coefficient) | 495 | costvec, ncostvec, coefficient) |
| 496 | SCREEN_PTR screen; | 496 | FRAME_PTR frame; |
| 497 | char *one_line_string, *multi_string; | 497 | char *one_line_string, *multi_string; |
| 498 | char *setup_string, *cleanup_string; | 498 | char *setup_string, *cleanup_string; |
| 499 | int *costvec, *ncostvec; | 499 | int *costvec, *ncostvec; |
| 500 | int coefficient; | 500 | int coefficient; |
| 501 | { | 501 | { |
| 502 | if (multi_string) | 502 | if (multi_string) |
| 503 | line_ins_del (screen, | 503 | line_ins_del (frame, |
| 504 | string_cost (multi_string) * coefficient, | 504 | string_cost (multi_string) * coefficient, |
| 505 | per_line_cost (multi_string) * coefficient, | 505 | per_line_cost (multi_string) * coefficient, |
| 506 | 0, 0, costvec, ncostvec); | 506 | 0, 0, costvec, ncostvec); |
| 507 | else if (one_line_string) | 507 | else if (one_line_string) |
| 508 | line_ins_del (screen, | 508 | line_ins_del (frame, |
| 509 | string_cost (setup_string) + string_cost (cleanup_string), 0, | 509 | string_cost (setup_string) + string_cost (cleanup_string), 0, |
| 510 | string_cost (one_line_string), | 510 | string_cost (one_line_string), |
| 511 | per_line_cost (one_line_string), | 511 | per_line_cost (one_line_string), |
| 512 | costvec, ncostvec); | 512 | costvec, ncostvec); |
| 513 | else | 513 | else |
| 514 | line_ins_del (screen, | 514 | line_ins_del (frame, |
| 515 | 9999, 0, 9999, 0, | 515 | 9999, 0, 9999, 0, |
| 516 | costvec, ncostvec); | 516 | costvec, ncostvec); |
| 517 | } | 517 | } |
| @@ -519,7 +519,7 @@ ins_del_costs (screen, | |||
| 519 | /* Calculate the insert and delete line costs. | 519 | /* Calculate the insert and delete line costs. |
| 520 | Note that this is done even when running with a window system | 520 | Note that this is done even when running with a window system |
| 521 | because we want to know how long scrolling takes (and avoid it). | 521 | because we want to know how long scrolling takes (and avoid it). |
| 522 | This must be redone whenever the screen height changes. | 522 | This must be redone whenever the frame height changes. |
| 523 | 523 | ||
| 524 | We keep the ID costs in a precomputed array based on the position | 524 | We keep the ID costs in a precomputed array based on the position |
| 525 | at which the I or D is performed. Also, there are two kinds of ID | 525 | at which the I or D is performed. Also, there are two kinds of ID |
| @@ -528,71 +528,71 @@ ins_del_costs (screen, | |||
| 528 | only) and those that must repeatedly insert one line. | 528 | only) and those that must repeatedly insert one line. |
| 529 | 529 | ||
| 530 | The cost to insert N lines at line L is | 530 | The cost to insert N lines at line L is |
| 531 | [tt.t_ILov + (screen_height + 1 - L) * tt.t_ILpf] + | 531 | [tt.t_ILov + (frame_height + 1 - L) * tt.t_ILpf] + |
| 532 | N * [tt.t_ILnov + (screen_height + 1 - L) * tt.t_ILnpf] | 532 | N * [tt.t_ILnov + (frame_height + 1 - L) * tt.t_ILnpf] |
| 533 | 533 | ||
| 534 | ILov represents the basic insert line overhead. ILpf is the padding | 534 | ILov represents the basic insert line overhead. ILpf is the padding |
| 535 | required to allow the terminal time to move a line: insertion at line | 535 | required to allow the terminal time to move a line: insertion at line |
| 536 | L changes (screen_height + 1 - L) lines. | 536 | L changes (frame_height + 1 - L) lines. |
| 537 | 537 | ||
| 538 | The first bracketed expression above is the overhead; the second is | 538 | The first bracketed expression above is the overhead; the second is |
| 539 | the multiply factor. Both are dependent only on the position at | 539 | the multiply factor. Both are dependent only on the position at |
| 540 | which the insert is performed. We store the overhead in | 540 | which the insert is performed. We store the overhead in |
| 541 | SCREEN_INSERT_COST (screen) and the multiply factor in | 541 | FRAME_INSERT_COST (frame) and the multiply factor in |
| 542 | SCREEN_INSERTN_COST (screen). Note however that any insertion | 542 | FRAME_INSERTN_COST (frame). Note however that any insertion |
| 543 | must include at least one multiply factor. Rather than compute this | 543 | must include at least one multiply factor. Rather than compute this |
| 544 | as SCREEN_INSERT_COST (screen)[line]+SCREEN_INSERTN_COST (screen)[line], | 544 | as FRAME_INSERT_COST (frame)[line]+FRAME_INSERTN_COST (frame)[line], |
| 545 | we add SCREEN_INSERTN_COST (screen) into SCREEN_INSERT_COST (screen). | 545 | we add FRAME_INSERTN_COST (frame) into FRAME_INSERT_COST (frame). |
| 546 | This is reasonable because of the particular algorithm used in calcM. | 546 | This is reasonable because of the particular algorithm used in calcM. |
| 547 | 547 | ||
| 548 | Deletion is essentially the same as insertion. | 548 | Deletion is essentially the same as insertion. |
| 549 | */ | 549 | */ |
| 550 | 550 | ||
| 551 | do_line_insertion_deletion_costs (screen, | 551 | do_line_insertion_deletion_costs (frame, |
| 552 | ins_line_string, multi_ins_string, | 552 | ins_line_string, multi_ins_string, |
| 553 | del_line_string, multi_del_string, | 553 | del_line_string, multi_del_string, |
| 554 | setup_string, cleanup_string, coefficient) | 554 | setup_string, cleanup_string, coefficient) |
| 555 | SCREEN_PTR screen; | 555 | FRAME_PTR frame; |
| 556 | char *ins_line_string, *multi_ins_string; | 556 | char *ins_line_string, *multi_ins_string; |
| 557 | char *del_line_string, *multi_del_string; | 557 | char *del_line_string, *multi_del_string; |
| 558 | char *setup_string, *cleanup_string; | 558 | char *setup_string, *cleanup_string; |
| 559 | int coefficient; | 559 | int coefficient; |
| 560 | { | 560 | { |
| 561 | if (SCREEN_INSERT_COST (screen) != 0) | 561 | if (FRAME_INSERT_COST (frame) != 0) |
| 562 | { | 562 | { |
| 563 | SCREEN_INSERT_COST (screen) = | 563 | FRAME_INSERT_COST (frame) = |
| 564 | (int *) xrealloc (SCREEN_INSERT_COST (screen), | 564 | (int *) xrealloc (FRAME_INSERT_COST (frame), |
| 565 | SCREEN_HEIGHT (screen) * sizeof (int)); | 565 | FRAME_HEIGHT (frame) * sizeof (int)); |
| 566 | SCREEN_DELETEN_COST (screen) = | 566 | FRAME_DELETEN_COST (frame) = |
| 567 | (int *) xrealloc (SCREEN_DELETEN_COST (screen), | 567 | (int *) xrealloc (FRAME_DELETEN_COST (frame), |
| 568 | SCREEN_HEIGHT (screen) * sizeof (int)); | 568 | FRAME_HEIGHT (frame) * sizeof (int)); |
| 569 | SCREEN_INSERTN_COST (screen) = | 569 | FRAME_INSERTN_COST (frame) = |
| 570 | (int *) xrealloc (SCREEN_INSERTN_COST (screen), | 570 | (int *) xrealloc (FRAME_INSERTN_COST (frame), |
| 571 | SCREEN_HEIGHT (screen) * sizeof (int)); | 571 | FRAME_HEIGHT (frame) * sizeof (int)); |
| 572 | SCREEN_DELETE_COST (screen) = | 572 | FRAME_DELETE_COST (frame) = |
| 573 | (int *) xrealloc (SCREEN_DELETE_COST (screen), | 573 | (int *) xrealloc (FRAME_DELETE_COST (frame), |
| 574 | SCREEN_HEIGHT (screen) * sizeof (int)); | 574 | FRAME_HEIGHT (frame) * sizeof (int)); |
| 575 | } | 575 | } |
| 576 | else | 576 | else |
| 577 | { | 577 | { |
| 578 | SCREEN_INSERT_COST (screen) = | 578 | FRAME_INSERT_COST (frame) = |
| 579 | (int *) xmalloc (SCREEN_HEIGHT (screen) * sizeof (int)); | 579 | (int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int)); |
| 580 | SCREEN_DELETEN_COST (screen) = | 580 | FRAME_DELETEN_COST (frame) = |
| 581 | (int *) xmalloc (SCREEN_HEIGHT (screen) * sizeof (int)); | 581 | (int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int)); |
| 582 | SCREEN_INSERTN_COST (screen) = | 582 | FRAME_INSERTN_COST (frame) = |
| 583 | (int *) xmalloc (SCREEN_HEIGHT (screen) * sizeof (int)); | 583 | (int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int)); |
| 584 | SCREEN_DELETE_COST (screen) = | 584 | FRAME_DELETE_COST (frame) = |
| 585 | (int *) xmalloc (SCREEN_HEIGHT (screen) * sizeof (int)); | 585 | (int *) xmalloc (FRAME_HEIGHT (frame) * sizeof (int)); |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | ins_del_costs (screen, | 588 | ins_del_costs (frame, |
| 589 | ins_line_string, multi_ins_string, | 589 | ins_line_string, multi_ins_string, |
| 590 | setup_string, cleanup_string, | 590 | setup_string, cleanup_string, |
| 591 | SCREEN_INSERT_COST (screen), SCREEN_INSERTN_COST (screen), | 591 | FRAME_INSERT_COST (frame), FRAME_INSERTN_COST (frame), |
| 592 | coefficient); | 592 | coefficient); |
| 593 | ins_del_costs (screen, | 593 | ins_del_costs (frame, |
| 594 | del_line_string, multi_del_string, | 594 | del_line_string, multi_del_string, |
| 595 | setup_string, cleanup_string, | 595 | setup_string, cleanup_string, |
| 596 | SCREEN_DELETEN_COST (screen), SCREEN_DELETE_COST (screen), | 596 | FRAME_DELETEN_COST (frame), FRAME_DELETE_COST (frame), |
| 597 | coefficient); | 597 | coefficient); |
| 598 | } | 598 | } |