diff options
| author | Richard M. Stallman | 1994-04-01 10:13:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-01 10:13:32 +0000 |
| commit | d52bad6588c2f50936f2fc210ea2af78f7631281 (patch) | |
| tree | 0acfba84c0e3c7e341958146c356480b93194751 /src | |
| parent | 09fe4c319e7de535b15dbc481cdd3362d62eee11 (diff) | |
| download | emacs-d52bad6588c2f50936f2fc210ea2af78f7631281.tar.gz emacs-d52bad6588c2f50936f2fc210ea2af78f7631281.zip | |
(make_frame_glyphs): If EMPTY, don't leave junk in ->total_charstarts.
(scroll_frame_lines): Typo in previous change.
Arg POS_ADJUST replaced with arg NEWPOS.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 887fbc81cbb..82d5616af4a 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -265,9 +265,13 @@ make_frame_glyphs (frame, empty) | |||
| 265 | /* Make the buffer used by decode_mode_spec. This buffer is also | 265 | /* Make the buffer used by decode_mode_spec. This buffer is also |
| 266 | used as temporary storage when updating the frame. See scroll.c. */ | 266 | used as temporary storage when updating the frame. See scroll.c. */ |
| 267 | unsigned int total_glyphs = (width + 2) * sizeof (GLYPH); | 267 | unsigned int total_glyphs = (width + 2) * sizeof (GLYPH); |
| 268 | unsigned int total_charstarts = (width + 2) * sizeof (int); | ||
| 268 | 269 | ||
| 269 | new->total_contents = (GLYPH *) xmalloc (total_glyphs); | 270 | new->total_contents = (GLYPH *) xmalloc (total_glyphs); |
| 270 | bzero (new->total_contents, total_glyphs); | 271 | bzero (new->total_contents, total_glyphs); |
| 272 | |||
| 273 | new->total_charstarts = (int *) xmalloc (total_charstarts); | ||
| 274 | bzero (new->total_charstarts, total_glyphs); | ||
| 271 | } | 275 | } |
| 272 | else | 276 | else |
| 273 | { | 277 | { |
| @@ -595,13 +599,14 @@ rotate_vector (vector, size, distance) | |||
| 595 | Returns nonzero if done, zero if terminal cannot scroll them. */ | 599 | Returns nonzero if done, zero if terminal cannot scroll them. */ |
| 596 | 600 | ||
| 597 | int | 601 | int |
| 598 | scroll_frame_lines (frame, from, end, amount, pos_adjust) | 602 | scroll_frame_lines (frame, from, end, amount, newpos) |
| 599 | register FRAME_PTR frame; | 603 | register FRAME_PTR frame; |
| 600 | int from, end, amount, pos_adjust; | 604 | int from, end, amount, newpos; |
| 601 | { | 605 | { |
| 602 | register int i; | 606 | register int i; |
| 603 | register struct frame_glyphs *current_frame | 607 | register struct frame_glyphs *current_frame |
| 604 | = FRAME_CURRENT_GLYPHS (frame); | 608 | = FRAME_CURRENT_GLYPHS (frame); |
| 609 | int pos_adjust; | ||
| 605 | 610 | ||
| 606 | if (!line_ins_del_ok) | 611 | if (!line_ins_del_ok) |
| 607 | return 0; | 612 | return 0; |
| @@ -623,24 +628,28 @@ scroll_frame_lines (frame, from, end, amount, pos_adjust) | |||
| 623 | amount * sizeof (GLYPH *)); | 628 | amount * sizeof (GLYPH *)); |
| 624 | 629 | ||
| 625 | rotate_vector (current_frame->charstarts + from, | 630 | rotate_vector (current_frame->charstarts + from, |
| 626 | sizeof (GLYPH *) * (end + amount - from), | 631 | sizeof (int *) * (end + amount - from), |
| 627 | amount * sizeof (GLYPH *)); | 632 | amount * sizeof (int *)); |
| 633 | |||
| 634 | /* Adjust the lines by an amount | ||
| 635 | that puts the first of them at NEWPOS. */ | ||
| 636 | pos_adjust = newpos - current_frame->charstarts[i][0]; | ||
| 628 | 637 | ||
| 629 | /* Offset each char position in the charstarts lines we moved | 638 | /* Offset each char position in the charstarts lines we moved |
| 630 | by pos_adjust. */ | 639 | by pos_adjust. */ |
| 631 | for (i = from + amount; i < end; i++) | 640 | for (i = from + amount; i < end; i++) |
| 632 | { | 641 | { |
| 633 | int *line = current_frame->charstarts[from]; | 642 | int *line = current_frame->charstarts[i]; |
| 634 | int col; | 643 | int col; |
| 635 | for (col = 0; col < current_frame->used[from]; col++) | 644 | for (col = 0; col < current_frame->used[i]; col++) |
| 636 | line[col] += pos_adjust; | 645 | line[col] += pos_adjust; |
| 637 | } | 646 | } |
| 638 | for (i = from; i <= from + amount; i++) | 647 | for (i = from; i <= from + amount; i++) |
| 639 | { | 648 | { |
| 640 | int *line = current_frame->charstarts[from]; | 649 | int *line = current_frame->charstarts[i]; |
| 641 | int col; | 650 | int col; |
| 642 | line[0] = -1; | 651 | line[0] = -1; |
| 643 | for (col = 0; col < current_frame->used[from]; col++) | 652 | for (col = 0; col < current_frame->used[i]; col++) |
| 644 | line[col] = 0; | 653 | line[col] = 0; |
| 645 | } | 654 | } |
| 646 | 655 | ||
| @@ -714,24 +723,28 @@ scroll_frame_lines (frame, from, end, amount, pos_adjust) | |||
| 714 | amount * sizeof (GLYPH *)); | 723 | amount * sizeof (GLYPH *)); |
| 715 | 724 | ||
| 716 | rotate_vector (current_frame->charstarts + from + amount, | 725 | rotate_vector (current_frame->charstarts + from + amount, |
| 717 | sizeof (GLYPH *) * (end - from - amount), | 726 | sizeof (int *) * (end - from - amount), |
| 718 | amount * sizeof (GLYPH *)); | 727 | amount * sizeof (int *)); |
| 728 | |||
| 729 | /* Adjust the lines by an amount | ||
| 730 | that puts the first of them at NEWPOS. */ | ||
| 731 | pos_adjust = newpos - current_frame->charstarts[i][0]; | ||
| 719 | 732 | ||
| 720 | /* Offset each char position in the charstarts lines we moved | 733 | /* Offset each char position in the charstarts lines we moved |
| 721 | by pos_adjust. */ | 734 | by pos_adjust. */ |
| 722 | for (i = from + amount; i < end + amount; i++) | 735 | for (i = from + amount; i < end + amount; i++) |
| 723 | { | 736 | { |
| 724 | int *line = current_frame->charstarts[from]; | 737 | int *line = current_frame->charstarts[i]; |
| 725 | int col; | 738 | int col; |
| 726 | for (col = 0; col < current_frame->used[from]; col++) | 739 | for (col = 0; col < current_frame->used[i]; col++) |
| 727 | line[col] += pos_adjust; | 740 | line[col] += pos_adjust; |
| 728 | } | 741 | } |
| 729 | for (i = end + amount; i <= end; i++) | 742 | for (i = end + amount; i <= end; i++) |
| 730 | { | 743 | { |
| 731 | int *line = current_frame->charstarts[from]; | 744 | int *line = current_frame->charstarts[i]; |
| 732 | int col; | 745 | int col; |
| 733 | line[0] = -1; | 746 | line[0] = -1; |
| 734 | for (col = 0; col < current_frame->used[from]; col++) | 747 | for (col = 0; col < current_frame->used[i]; col++) |
| 735 | line[col] = 0; | 748 | line[col] = 0; |
| 736 | } | 749 | } |
| 737 | 750 | ||