diff options
| author | Richard M. Stallman | 1994-04-03 01:36:57 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-03 01:36:57 +0000 |
| commit | 23b0200c6720b66efc40be80b49a27a320bffb8c (patch) | |
| tree | ef097c43881e5c8fc33af35cc4580a22a5b89aa5 /src | |
| parent | 84258c5dcce7af9aadfcd126f93fdce27309b108 (diff) | |
| download | emacs-23b0200c6720b66efc40be80b49a27a320bffb8c.tar.gz emacs-23b0200c6720b66efc40be80b49a27a320bffb8c.zip | |
(verify_charstarts): New function.
(scroll_frame_lines): When updating charstarts,
treat all columns alike--don't zero out any.
Fix end tests of loops over i.
(adjust_window_charstarts): Fix typo.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 110 |
1 files changed, 71 insertions, 39 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 82d5616af4a..68e9423fcbd 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -607,6 +607,7 @@ scroll_frame_lines (frame, from, end, amount, newpos) | |||
| 607 | register struct frame_glyphs *current_frame | 607 | register struct frame_glyphs *current_frame |
| 608 | = FRAME_CURRENT_GLYPHS (frame); | 608 | = FRAME_CURRENT_GLYPHS (frame); |
| 609 | int pos_adjust; | 609 | int pos_adjust; |
| 610 | int width = FRAME_WIDTH (frame); | ||
| 610 | 611 | ||
| 611 | if (!line_ins_del_ok) | 612 | if (!line_ins_del_ok) |
| 612 | return 0; | 613 | return 0; |
| @@ -631,40 +632,41 @@ scroll_frame_lines (frame, from, end, amount, newpos) | |||
| 631 | sizeof (int *) * (end + amount - from), | 632 | sizeof (int *) * (end + amount - from), |
| 632 | amount * sizeof (int *)); | 633 | amount * sizeof (int *)); |
| 633 | 634 | ||
| 635 | safe_bcopy (current_frame->used + from, | ||
| 636 | current_frame->used + from + amount, | ||
| 637 | (end - from) * sizeof current_frame->used[0]); | ||
| 638 | |||
| 639 | safe_bcopy (current_frame->highlight + from, | ||
| 640 | current_frame->highlight + from + amount, | ||
| 641 | (end - from) * sizeof current_frame->highlight[0]); | ||
| 642 | |||
| 643 | safe_bcopy (current_frame->enable + from, | ||
| 644 | current_frame->enable + from + amount, | ||
| 645 | (end - from) * sizeof current_frame->enable[0]); | ||
| 646 | |||
| 634 | /* Adjust the lines by an amount | 647 | /* Adjust the lines by an amount |
| 635 | that puts the first of them at NEWPOS. */ | 648 | that puts the first of them at NEWPOS. */ |
| 636 | pos_adjust = newpos - current_frame->charstarts[i][0]; | 649 | pos_adjust = newpos - current_frame->charstarts[from + amount][0]; |
| 637 | 650 | ||
| 638 | /* Offset each char position in the charstarts lines we moved | 651 | /* Offset each char position in the charstarts lines we moved |
| 639 | by pos_adjust. */ | 652 | by pos_adjust. */ |
| 640 | for (i = from + amount; i < end; i++) | 653 | for (i = from + amount; i < end + amount; i++) |
| 641 | { | 654 | { |
| 642 | int *line = current_frame->charstarts[i]; | 655 | int *line = current_frame->charstarts[i]; |
| 643 | int col; | 656 | int col; |
| 644 | for (col = 0; col < current_frame->used[i]; col++) | 657 | for (col = 0; col < width; col++) |
| 645 | line[col] += pos_adjust; | 658 | if (line[col] > 0) |
| 659 | line[col] += pos_adjust; | ||
| 646 | } | 660 | } |
| 647 | for (i = from; i <= from + amount; i++) | 661 | for (i = from; i < from + amount; i++) |
| 648 | { | 662 | { |
| 649 | int *line = current_frame->charstarts[i]; | 663 | int *line = current_frame->charstarts[i]; |
| 650 | int col; | 664 | int col; |
| 651 | line[0] = -1; | 665 | line[0] = -1; |
| 652 | for (col = 0; col < current_frame->used[i]; col++) | 666 | for (col = 0; col < width; col++) |
| 653 | line[col] = 0; | 667 | line[col] = 0; |
| 654 | } | 668 | } |
| 655 | 669 | ||
| 656 | safe_bcopy (current_frame->used + from, | ||
| 657 | current_frame->used + from + amount, | ||
| 658 | (end - from) * sizeof current_frame->used[0]); | ||
| 659 | |||
| 660 | safe_bcopy (current_frame->highlight + from, | ||
| 661 | current_frame->highlight + from + amount, | ||
| 662 | (end - from) * sizeof current_frame->highlight[0]); | ||
| 663 | |||
| 664 | safe_bcopy (current_frame->enable + from, | ||
| 665 | current_frame->enable + from + amount, | ||
| 666 | (end - from) * sizeof current_frame->enable[0]); | ||
| 667 | |||
| 668 | /* Mark the lines made empty by scrolling as enabled, empty and | 670 | /* Mark the lines made empty by scrolling as enabled, empty and |
| 669 | normal video. */ | 671 | normal video. */ |
| 670 | bzero (current_frame->used + from, | 672 | bzero (current_frame->used + from, |
| @@ -726,9 +728,21 @@ scroll_frame_lines (frame, from, end, amount, newpos) | |||
| 726 | sizeof (int *) * (end - from - amount), | 728 | sizeof (int *) * (end - from - amount), |
| 727 | amount * sizeof (int *)); | 729 | amount * sizeof (int *)); |
| 728 | 730 | ||
| 731 | safe_bcopy (current_frame->used + from, | ||
| 732 | current_frame->used + from + amount, | ||
| 733 | (end - from) * sizeof current_frame->used[0]); | ||
| 734 | |||
| 735 | safe_bcopy (current_frame->highlight + from, | ||
| 736 | current_frame->highlight + from + amount, | ||
| 737 | (end - from) * sizeof current_frame->highlight[0]); | ||
| 738 | |||
| 739 | safe_bcopy (current_frame->enable + from, | ||
| 740 | current_frame->enable + from + amount, | ||
| 741 | (end - from) * sizeof current_frame->enable[0]); | ||
| 742 | |||
| 729 | /* Adjust the lines by an amount | 743 | /* Adjust the lines by an amount |
| 730 | that puts the first of them at NEWPOS. */ | 744 | that puts the first of them at NEWPOS. */ |
| 731 | pos_adjust = newpos - current_frame->charstarts[i][0]; | 745 | pos_adjust = newpos - current_frame->charstarts[from + amount][0]; |
| 732 | 746 | ||
| 733 | /* Offset each char position in the charstarts lines we moved | 747 | /* Offset each char position in the charstarts lines we moved |
| 734 | by pos_adjust. */ | 748 | by pos_adjust. */ |
| @@ -736,30 +750,19 @@ scroll_frame_lines (frame, from, end, amount, newpos) | |||
| 736 | { | 750 | { |
| 737 | int *line = current_frame->charstarts[i]; | 751 | int *line = current_frame->charstarts[i]; |
| 738 | int col; | 752 | int col; |
| 739 | for (col = 0; col < current_frame->used[i]; col++) | 753 | for (col = 0; col < width; col++) |
| 740 | line[col] += pos_adjust; | 754 | if (line[col] > 0) |
| 755 | line[col] += pos_adjust; | ||
| 741 | } | 756 | } |
| 742 | for (i = end + amount; i <= end; i++) | 757 | for (i = end + amount; i < end; i++) |
| 743 | { | 758 | { |
| 744 | int *line = current_frame->charstarts[i]; | 759 | int *line = current_frame->charstarts[i]; |
| 745 | int col; | 760 | int col; |
| 746 | line[0] = -1; | 761 | line[0] = -1; |
| 747 | for (col = 0; col < current_frame->used[i]; col++) | 762 | for (col = 0; col < width; col++) |
| 748 | line[col] = 0; | 763 | line[col] = 0; |
| 749 | } | 764 | } |
| 750 | 765 | ||
| 751 | safe_bcopy (current_frame->used + from, | ||
| 752 | current_frame->used + from + amount, | ||
| 753 | (end - from) * sizeof current_frame->used[0]); | ||
| 754 | |||
| 755 | safe_bcopy (current_frame->highlight + from, | ||
| 756 | current_frame->highlight + from + amount, | ||
| 757 | (end - from) * sizeof current_frame->highlight[0]); | ||
| 758 | |||
| 759 | safe_bcopy (current_frame->enable + from, | ||
| 760 | current_frame->enable + from + amount, | ||
| 761 | (end - from) * sizeof current_frame->enable[0]); | ||
| 762 | |||
| 763 | /* Mark the lines made empty by scrolling as enabled, empty and | 766 | /* Mark the lines made empty by scrolling as enabled, empty and |
| 764 | normal video. */ | 767 | normal video. */ |
| 765 | bzero (current_frame->used + end + amount, | 768 | bzero (current_frame->used + end + amount, |
| @@ -906,7 +909,7 @@ preserve_my_columns (w) | |||
| 906 | #endif | 909 | #endif |
| 907 | 910 | ||
| 908 | /* Adjust by ADJUST the charstart values in window W | 911 | /* Adjust by ADJUST the charstart values in window W |
| 909 | before vpos VPOS, which counts relative to the frame | 912 | after vpos VPOS, which counts relative to the frame |
| 910 | (not relative to W itself). */ | 913 | (not relative to W itself). */ |
| 911 | 914 | ||
| 912 | void | 915 | void |
| @@ -917,11 +920,11 @@ adjust_window_charstarts (w, vpos, adjust) | |||
| 917 | { | 920 | { |
| 918 | int left = XFASTINT (w->left); | 921 | int left = XFASTINT (w->left); |
| 919 | int top = XFASTINT (w->top); | 922 | int top = XFASTINT (w->top); |
| 920 | int right = left + window_internal_height (w); | 923 | int right = left + window_internal_width (w); |
| 921 | int height = window_internal_height (w); | 924 | int bottom = top + window_internal_height (w); |
| 922 | int i; | 925 | int i; |
| 923 | 926 | ||
| 924 | for (i = vpos + 1; i < top + height; i++) | 927 | for (i = vpos + 1; i < bottom; i++) |
| 925 | { | 928 | { |
| 926 | int *charstart | 929 | int *charstart |
| 927 | = FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[i]; | 930 | = FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[i]; |
| @@ -931,6 +934,35 @@ adjust_window_charstarts (w, vpos, adjust) | |||
| 931 | charstart[j] += adjust; | 934 | charstart[j] += adjust; |
| 932 | } | 935 | } |
| 933 | } | 936 | } |
| 937 | |||
| 938 | verify_charstarts (w) | ||
| 939 | struct window *w; | ||
| 940 | { | ||
| 941 | FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); | ||
| 942 | int i; | ||
| 943 | int top = XFASTINT (w->top); | ||
| 944 | int bottom = top + window_internal_height (w); | ||
| 945 | int left = XFASTINT (w->left); | ||
| 946 | int right = left + window_internal_width (w); | ||
| 947 | int next_line; | ||
| 948 | |||
| 949 | for (i = top; i < bottom; i++) | ||
| 950 | { | ||
| 951 | int j; | ||
| 952 | int last; | ||
| 953 | int *charstart | ||
| 954 | = FRAME_CURRENT_GLYPHS (XFRAME (WINDOW_FRAME (w)))->charstarts[i]; | ||
| 955 | |||
| 956 | if (i != top) | ||
| 957 | if (charstart[left] != next_line) | ||
| 958 | abort (); | ||
| 959 | |||
| 960 | for (j = left; j < right; j++) | ||
| 961 | if (charstart[j] > 0) | ||
| 962 | last = charstart[j]; | ||
| 963 | next_line = last + (BUF_ZV (XBUFFER (w->buffer)) != last); | ||
| 964 | } | ||
| 965 | } | ||
| 934 | 966 | ||
| 935 | /* On discovering that the redisplay for a window was no good, | 967 | /* On discovering that the redisplay for a window was no good, |
| 936 | cancel the columns of that window, so that when the window is | 968 | cancel the columns of that window, so that when the window is |