aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-03-31 23:22:23 +0000
committerRichard M. Stallman1994-03-31 23:22:23 +0000
commit60a8948ae488b0f4c640f1a4495dfbc22daaef01 (patch)
tree7de080bf809091bb298a324dc159c840f970b663 /src
parentb8009dd11c657bac01ca1ab43fed44ab896448a5 (diff)
downloademacs-60a8948ae488b0f4c640f1a4495dfbc22daaef01.tar.gz
emacs-60a8948ae488b0f4c640f1a4495dfbc22daaef01.zip
(scroll_frame_lines): Handle charstarts like glyphs.
(direct_output_for_insert): Likewise. (preserve_other_columns): Likewise. (update_line): Update charstarts like glyphs. (make_frame_glyphs): Initialize charstarts, total_charstarts. (free_frame_glyphs): Free those fields.
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c115
1 files changed, 106 insertions, 9 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index e954d62312e..c4d9b2ec364 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1,5 +1,5 @@
1/* Updating of data structures for redisplay. 1/* Updating of data structures for redisplay.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993 Free Software Foundation, Inc. 2 Copyright (C) 1985, 86, 87, 88, 93, 94 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -235,14 +235,15 @@ make_frame_glyphs (frame, empty)
235 register int i; 235 register int i;
236 register width = FRAME_WIDTH (frame); 236 register width = FRAME_WIDTH (frame);
237 register height = FRAME_HEIGHT (frame); 237 register height = FRAME_HEIGHT (frame);
238 register struct frame_glyphs *new = 238 register struct frame_glyphs *new
239 (struct frame_glyphs *) xmalloc (sizeof (struct frame_glyphs)); 239 = (struct frame_glyphs *) xmalloc (sizeof (struct frame_glyphs));
240 240
241 SET_GLYPHS_FRAME (new, frame); 241 SET_GLYPHS_FRAME (new, frame);
242 new->height = height; 242 new->height = height;
243 new->width = width; 243 new->width = width;
244 new->used = (int *) xmalloc (height * sizeof (int)); 244 new->used = (int *) xmalloc (height * sizeof (int));
245 new->glyphs = (GLYPH **) xmalloc (height * sizeof (GLYPH *)); 245 new->glyphs = (GLYPH **) xmalloc (height * sizeof (GLYPH *));
246 new->charstarts = (int **) xmalloc (height * sizeof (int *));
246 new->highlight = (char *) xmalloc (height * sizeof (char)); 247 new->highlight = (char *) xmalloc (height * sizeof (char));
247 new->enable = (char *) xmalloc (height * sizeof (char)); 248 new->enable = (char *) xmalloc (height * sizeof (char));
248 bzero (new->enable, height * sizeof (char)); 249 bzero (new->enable, height * sizeof (char));
@@ -276,6 +277,25 @@ make_frame_glyphs (frame, empty)
276 bzero (new->total_contents, total_glyphs); 277 bzero (new->total_contents, total_glyphs);
277 for (i = 0; i < height; i++) 278 for (i = 0; i < height; i++)
278 new->glyphs[i] = new->total_contents + i * (width + 2) + 1; 279 new->glyphs[i] = new->total_contents + i * (width + 2) + 1;
280
281 if (!FRAME_TERMCAP_P (frame))
282 {
283 unsigned int total_charstarts = height * (width + 2) * sizeof (int);
284
285 new->total_charstarts = (int *) xmalloc (total_charstarts);
286 bzero (new->total_charstarts, total_charstarts);
287 for (i = 0; i < height; i++)
288 new->charstarts[i] = new->total_charstarts + i * (width + 2) + 1;
289 }
290 else
291 {
292 /* Without a window system, we don't really need charstarts.
293 So use a small amount of space to make enough data structure
294 to prevent crashes in display_text_line. */
295 new->total_charstarts = (int *) xmalloc ((width + 2) * sizeof (int));
296 for (i = 0; i < height; i++)
297 new->charstarts[i] = new->total_charstarts;
298 }
279 } 299 }
280 300
281 return new; 301 return new;
@@ -288,12 +308,16 @@ free_frame_glyphs (frame, glyphs)
288{ 308{
289 if (glyphs->total_contents) 309 if (glyphs->total_contents)
290 xfree (glyphs->total_contents); 310 xfree (glyphs->total_contents);
311 if (glyphs->total_charstarts)
312 xfree (glyphs->total_charstarts);
291 313
292 xfree (glyphs->used); 314 xfree (glyphs->used);
293 xfree (glyphs->glyphs); 315 xfree (glyphs->glyphs);
294 xfree (glyphs->highlight); 316 xfree (glyphs->highlight);
295 xfree (glyphs->enable); 317 xfree (glyphs->enable);
296 xfree (glyphs->bufp); 318 xfree (glyphs->bufp);
319 if (glyphs->charstarts)
320 xfree (glyphs->charstarts);
297 321
298#ifdef HAVE_X_WINDOWS 322#ifdef HAVE_X_WINDOWS
299 if (FRAME_X_P (frame)) 323 if (FRAME_X_P (frame))
@@ -571,9 +595,9 @@ rotate_vector (vector, size, distance)
571 Returns nonzero if done, zero if terminal cannot scroll them. */ 595 Returns nonzero if done, zero if terminal cannot scroll them. */
572 596
573int 597int
574scroll_frame_lines (frame, from, end, amount) 598scroll_frame_lines (frame, from, end, amount, pos_adjust)
575 register FRAME_PTR frame; 599 register FRAME_PTR frame;
576 int from, end, amount; 600 int from, end, amount, pos_adjust;
577{ 601{
578 register int i; 602 register int i;
579 register struct frame_glyphs *current_frame 603 register struct frame_glyphs *current_frame
@@ -598,6 +622,28 @@ scroll_frame_lines (frame, from, end, amount)
598 sizeof (GLYPH *) * (end + amount - from), 622 sizeof (GLYPH *) * (end + amount - from),
599 amount * sizeof (GLYPH *)); 623 amount * sizeof (GLYPH *));
600 624
625 rotate_vector (current_frame->charstarts + from,
626 sizeof (GLYPH *) * (end + amount - from),
627 amount * sizeof (GLYPH *));
628
629 /* Offset each char position in the charstarts lines we moved
630 by pos_adjust. */
631 for (i = from + amount; i < end; i++)
632 {
633 int *line = current_frame->charstarts[from];
634 int col;
635 for (col = 0; col < current_frame->used[from]; col++)
636 line[col] += pos_adjust;
637 }
638 for (i = from; i <= from + amount; i++)
639 {
640 int *line = current_frame->charstarts[from];
641 int col;
642 line[0] = -1;
643 for (col = 0; col < current_frame->used[from]; col++)
644 line[col] = 0;
645 }
646
601 safe_bcopy (current_frame->used + from, 647 safe_bcopy (current_frame->used + from,
602 current_frame->used + from + amount, 648 current_frame->used + from + amount,
603 (end - from) * sizeof current_frame->used[0]); 649 (end - from) * sizeof current_frame->used[0]);
@@ -619,6 +665,7 @@ scroll_frame_lines (frame, from, end, amount)
619 for (i = from; i < from + amount; i++) 665 for (i = from; i < from + amount; i++)
620 { 666 {
621 current_frame->glyphs[i][0] = '\0'; 667 current_frame->glyphs[i][0] = '\0';
668 current_frame->charstarts[i][0] = -1;
622 current_frame->enable[i] = 1; 669 current_frame->enable[i] = 1;
623 } 670 }
624 671
@@ -666,6 +713,28 @@ scroll_frame_lines (frame, from, end, amount)
666 sizeof (GLYPH *) * (end - from - amount), 713 sizeof (GLYPH *) * (end - from - amount),
667 amount * sizeof (GLYPH *)); 714 amount * sizeof (GLYPH *));
668 715
716 rotate_vector (current_frame->charstarts + from + amount,
717 sizeof (GLYPH *) * (end - from - amount),
718 amount * sizeof (GLYPH *));
719
720 /* Offset each char position in the charstarts lines we moved
721 by pos_adjust. */
722 for (i = from + amount; i < end + amount; i++)
723 {
724 int *line = current_frame->charstarts[from];
725 int col;
726 for (col = 0; col < current_frame->used[from]; col++)
727 line[col] += pos_adjust;
728 }
729 for (i = end + amount; i <= end; i++)
730 {
731 int *line = current_frame->charstarts[from];
732 int col;
733 line[0] = -1;
734 for (col = 0; col < current_frame->used[from]; col++)
735 line[col] = 0;
736 }
737
669 safe_bcopy (current_frame->used + from, 738 safe_bcopy (current_frame->used + from,
670 current_frame->used + from + amount, 739 current_frame->used + from + amount,
671 (end - from) * sizeof current_frame->used[0]); 740 (end - from) * sizeof current_frame->used[0]);
@@ -687,6 +756,7 @@ scroll_frame_lines (frame, from, end, amount)
687 for (i = end + amount; i < end; i++) 756 for (i = end + amount; i < end; i++)
688 { 757 {
689 current_frame->glyphs[i][0] = '\0'; 758 current_frame->glyphs[i][0] = '\0';
759 current_frame->charstarts[i][0] = 0;
690 current_frame->enable[i] = 1; 760 current_frame->enable[i] = 1;
691 } 761 }
692 762
@@ -753,6 +823,9 @@ preserve_other_columns (w)
753 bcopy (current_frame->glyphs[vpos], 823 bcopy (current_frame->glyphs[vpos],
754 desired_frame->glyphs[vpos], 824 desired_frame->glyphs[vpos],
755 start * sizeof (current_frame->glyphs[vpos])); 825 start * sizeof (current_frame->glyphs[vpos]));
826 bcopy (current_frame->charstarts[vpos],
827 desired_frame->charstarts[vpos],
828 start * sizeof (current_frame->charstarts[vpos]));
756 len = min (start, current_frame->used[vpos]); 829 len = min (start, current_frame->used[vpos]);
757 if (desired_frame->used[vpos] < len) 830 if (desired_frame->used[vpos] < len)
758 desired_frame->used[vpos] = len; 831 desired_frame->used[vpos] = len;
@@ -761,12 +834,19 @@ preserve_other_columns (w)
761 && desired_frame->used[vpos] < current_frame->used[vpos]) 834 && desired_frame->used[vpos] < current_frame->used[vpos])
762 { 835 {
763 while (desired_frame->used[vpos] < end) 836 while (desired_frame->used[vpos] < end)
764 desired_frame->glyphs[vpos][desired_frame->used[vpos]++] 837 {
765 = SPACEGLYPH; 838 int used = desired_frame->used[vpos]++;
839 desired_frame->glyphs[vpos][used] = SPACEGLYPH;
840 desired_frame->glyphs[vpos][used] = 0;
841 }
766 bcopy (current_frame->glyphs[vpos] + end, 842 bcopy (current_frame->glyphs[vpos] + end,
767 desired_frame->glyphs[vpos] + end, 843 desired_frame->glyphs[vpos] + end,
768 ((current_frame->used[vpos] - end) 844 ((current_frame->used[vpos] - end)
769 * sizeof (current_frame->glyphs[vpos]))); 845 * sizeof (current_frame->glyphs[vpos])));
846 bcopy (current_frame->charstarts[vpos] + end,
847 desired_frame->charstarts[vpos] + end,
848 ((current_frame->used[vpos] - end)
849 * sizeof (current_frame->charstarts[vpos])));
770 desired_frame->used[vpos] = current_frame->used[vpos]; 850 desired_frame->used[vpos] = current_frame->used[vpos];
771 } 851 }
772 } 852 }
@@ -820,8 +900,8 @@ cancel_my_columns (w)
820 struct window *w; 900 struct window *w;
821{ 901{
822 register int vpos; 902 register int vpos;
823 register struct frame_glyphs *desired_glyphs = 903 register struct frame_glyphs *desired_glyphs
824 FRAME_DESIRED_GLYPHS (XFRAME (w->frame)); 904 = FRAME_DESIRED_GLYPHS (XFRAME (w->frame));
825 register int start = XFASTINT (w->left); 905 register int start = XFASTINT (w->left);
826 register int bot = XFASTINT (w->top) + XFASTINT (w->height); 906 register int bot = XFASTINT (w->top) + XFASTINT (w->height);
827 907
@@ -898,6 +978,7 @@ direct_output_for_insert (g)
898 int face = compute_char_face (frame, w, point - 1, -1, -1, &dummy, point); 978 int face = compute_char_face (frame, w, point - 1, -1, -1, &dummy, point);
899#endif 979#endif
900 current_frame->glyphs[vpos][hpos] = MAKE_GLYPH (frame, g, face); 980 current_frame->glyphs[vpos][hpos] = MAKE_GLYPH (frame, g, face);
981 current_frame->charstarts[vpos][hpos] = point;
901 } 982 }
902 unchanged_modified = MODIFF; 983 unchanged_modified = MODIFF;
903 beg_unchanged = GPT - BEG; 984 beg_unchanged = GPT - BEG;
@@ -1321,6 +1402,7 @@ update_line (frame, vpos)
1321 int vpos; 1402 int vpos;
1322{ 1403{
1323 register GLYPH *obody, *nbody, *op1, *op2, *np1, *temp; 1404 register GLYPH *obody, *nbody, *op1, *op2, *np1, *temp;
1405 int *temp1;
1324 int tem; 1406 int tem;
1325 int osp, nsp, begmatch, endmatch, olen, nlen; 1407 int osp, nsp, begmatch, endmatch, olen, nlen;
1326 int save; 1408 int save;
@@ -1463,6 +1545,11 @@ update_line (frame, vpos)
1463 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos]; 1545 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos];
1464 current_frame->glyphs[vpos] = temp; 1546 current_frame->glyphs[vpos] = temp;
1465 1547
1548 /* Exchange charstarts between current_frame and new_frame. */
1549 temp1 = desired_frame->charstarts[vpos];
1550 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos];
1551 current_frame->charstarts[vpos] = temp1;
1552
1466 return; 1553 return;
1467 } 1554 }
1468 1555
@@ -1481,6 +1568,11 @@ update_line (frame, vpos)
1481 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos]; 1568 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos];
1482 current_frame->glyphs[vpos] = temp; 1569 current_frame->glyphs[vpos] = temp;
1483 1570
1571 /* Exchange charstarts between current_frame and new_frame. */
1572 temp1 = desired_frame->charstarts[vpos];
1573 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos];
1574 current_frame->charstarts[vpos] = temp1;
1575
1484 return; 1576 return;
1485 } 1577 }
1486 1578
@@ -1641,6 +1733,11 @@ update_line (frame, vpos)
1641 temp = desired_frame->glyphs[vpos]; 1733 temp = desired_frame->glyphs[vpos];
1642 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos]; 1734 desired_frame->glyphs[vpos] = current_frame->glyphs[vpos];
1643 current_frame->glyphs[vpos] = temp; 1735 current_frame->glyphs[vpos] = temp;
1736
1737 /* Exchange charstarts between current_frame and new_frame. */
1738 temp1 = desired_frame->charstarts[vpos];
1739 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos];
1740 current_frame->charstarts[vpos] = temp1;
1644} 1741}
1645 1742
1646DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript, 1743DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript,