Mercurial > emacs
comparison src/dispnew.c @ 6627:f8471ecf787b
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 01 Apr 1994 10:13:32 +0000 |
parents | 990d7d5095dc |
children | 2fda5dd17356 |
comparison
equal
deleted
inserted
replaced
6626:59c44532d2a0 | 6627:f8471ecf787b |
---|---|
263 if (empty) | 263 if (empty) |
264 { | 264 { |
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 { |
274 unsigned int total_glyphs = height * (width + 2) * sizeof (GLYPH); | 278 unsigned int total_glyphs = height * (width + 2) * sizeof (GLYPH); |
275 | 279 |
593 /* Scroll lines from vpos FROM up to but not including vpos END | 597 /* Scroll lines from vpos FROM up to but not including vpos END |
594 down by AMOUNT lines (AMOUNT may be negative). | 598 down by AMOUNT lines (AMOUNT may be negative). |
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; |
608 | 613 |
609 if (amount == 0) | 614 if (amount == 0) |
621 rotate_vector (current_frame->glyphs + from, | 626 rotate_vector (current_frame->glyphs + from, |
622 sizeof (GLYPH *) * (end + amount - from), | 627 sizeof (GLYPH *) * (end + amount - from), |
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 |
647 safe_bcopy (current_frame->used + from, | 656 safe_bcopy (current_frame->used + from, |
648 current_frame->used + from + amount, | 657 current_frame->used + from + amount, |
712 rotate_vector (current_frame->glyphs + from + amount, | 721 rotate_vector (current_frame->glyphs + from + amount, |
713 sizeof (GLYPH *) * (end - from - amount), | 722 sizeof (GLYPH *) * (end - from - amount), |
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 |
738 safe_bcopy (current_frame->used + from, | 751 safe_bcopy (current_frame->used + from, |
739 current_frame->used + from + amount, | 752 current_frame->used + from + amount, |