aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-02-06 13:58:18 +0000
committerGerd Moellmann2001-02-06 13:58:18 +0000
commitc363a1d6fdd39d16401a6eee3d66c870ed7c251b (patch)
tree75f994c89f89c88e047f8f81243186d4a63d287b /src
parent36710aa6967c96f69171126adf790415042d5948 (diff)
downloademacs-c363a1d6fdd39d16401a6eee3d66c870ed7c251b.tar.gz
emacs-c363a1d6fdd39d16401a6eee3d66c870ed7c251b.zip
(update_frame_line): Rename parameter FRAME to F.
Avoid some unnecessary cursor positioning.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/dispnew.c54
2 files changed, 39 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index df8e58ac4bc..f0b7c6ef2b5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12001-02-06 Gerd Moellmann <gerd@gnu.org>
2
3 * dispnew.c (update_frame_line): Rename parameter FRAME to F.
4 Avoid some unnecessary cursor positioning.
5
12001-02-05 Gerd Moellmann <gerd@gnu.org> 62001-02-05 Gerd Moellmann <gerd@gnu.org>
2 7
3 * xfaces.c (split_font_name): Compute numeric value of 8 * xfaces.c (split_font_name): Compute numeric value of
diff --git a/src/dispnew.c b/src/dispnew.c
index c7a65823819..be75ffe24b4 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5334,20 +5334,20 @@ extern int *char_ins_del_vector;
5334/* Perform a frame-based update on line VPOS in frame FRAME. */ 5334/* Perform a frame-based update on line VPOS in frame FRAME. */
5335 5335
5336static void 5336static void
5337update_frame_line (frame, vpos) 5337update_frame_line (f, vpos)
5338 register struct frame *frame; 5338 struct frame *f;
5339 int vpos; 5339 int vpos;
5340{ 5340{
5341 struct glyph *obody, *nbody, *op1, *op2, *np1, *nend; 5341 struct glyph *obody, *nbody, *op1, *op2, *np1, *nend;
5342 int tem; 5342 int tem;
5343 int osp, nsp, begmatch, endmatch, olen, nlen; 5343 int osp, nsp, begmatch, endmatch, olen, nlen;
5344 struct glyph_matrix *current_matrix = frame->current_matrix; 5344 struct glyph_matrix *current_matrix = f->current_matrix;
5345 struct glyph_matrix *desired_matrix = frame->desired_matrix; 5345 struct glyph_matrix *desired_matrix = f->desired_matrix;
5346 struct glyph_row *current_row = MATRIX_ROW (current_matrix, vpos); 5346 struct glyph_row *current_row = MATRIX_ROW (current_matrix, vpos);
5347 struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, vpos); 5347 struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, vpos);
5348 int must_write_whole_line_p; 5348 int must_write_whole_line_p;
5349 int write_spaces_p = must_write_spaces; 5349 int write_spaces_p = must_write_spaces;
5350 int colored_spaces_p = (FACE_FROM_ID (frame, DEFAULT_FACE_ID)->background 5350 int colored_spaces_p = (FACE_FROM_ID (f, DEFAULT_FACE_ID)->background
5351 != FACE_TTY_DEFAULT_BG_COLOR); 5351 != FACE_TTY_DEFAULT_BG_COLOR);
5352 5352
5353 if (colored_spaces_p) 5353 if (colored_spaces_p)
@@ -5388,7 +5388,7 @@ update_frame_line (frame, vpos)
5388 /* For an inverse-video line, make sure it's filled with 5388 /* For an inverse-video line, make sure it's filled with
5389 spaces all the way to the frame edge so that the reverse 5389 spaces all the way to the frame edge so that the reverse
5390 video extends all the way across. */ 5390 video extends all the way across. */
5391 while (olen < FRAME_WIDTH (frame) - 1) 5391 while (olen < FRAME_WIDTH (f) - 1)
5392 obody[olen++] = space_glyph; 5392 obody[olen++] = space_glyph;
5393 } 5393 }
5394 } 5394 }
@@ -5426,10 +5426,10 @@ update_frame_line (frame, vpos)
5426 /* Don't call clear_end_of_line if we already wrote the whole 5426 /* Don't call clear_end_of_line if we already wrote the whole
5427 line. The cursor will not be at the right margin in that 5427 line. The cursor will not be at the right margin in that
5428 case but in the line below. */ 5428 case but in the line below. */
5429 if (nlen < FRAME_WINDOW_WIDTH (frame)) 5429 if (nlen < FRAME_WINDOW_WIDTH (f))
5430 { 5430 {
5431 cursor_to (vpos, nlen); 5431 cursor_to (vpos, nlen);
5432 clear_end_of_line (FRAME_WINDOW_WIDTH (frame)); 5432 clear_end_of_line (FRAME_WINDOW_WIDTH (f));
5433 } 5433 }
5434 else 5434 else
5435 /* Make sure we are in the right row, otherwise cursor movement 5435 /* Make sure we are in the right row, otherwise cursor movement
@@ -5453,7 +5453,7 @@ update_frame_line (frame, vpos)
5453 /* For an inverse-video line, give it extra trailing spaces all 5453 /* For an inverse-video line, give it extra trailing spaces all
5454 the way to the frame edge so that the reverse video extends 5454 the way to the frame edge so that the reverse video extends
5455 all the way across. */ 5455 all the way across. */
5456 while (nlen < FRAME_WIDTH (frame) - 1) 5456 while (nlen < FRAME_WIDTH (f) - 1)
5457 nbody[nlen++] = space_glyph; 5457 nbody[nlen++] = space_glyph;
5458 } 5458 }
5459 5459
@@ -5563,7 +5563,7 @@ update_frame_line (frame, vpos)
5563 5563
5564 tem = (nlen - nsp) - (olen - osp); 5564 tem = (nlen - nsp) - (olen - osp);
5565 if (endmatch && tem 5565 if (endmatch && tem
5566 && (!char_ins_del_ok || endmatch <= char_ins_del_cost (frame)[tem])) 5566 && (!char_ins_del_ok || endmatch <= char_ins_del_cost (f)[tem]))
5567 endmatch = 0; 5567 endmatch = 0;
5568 5568
5569 /* nsp - osp is the distance to insert or delete. 5569 /* nsp - osp is the distance to insert or delete.
@@ -5573,7 +5573,7 @@ update_frame_line (frame, vpos)
5573 5573
5574 if (nsp != osp 5574 if (nsp != osp
5575 && (!char_ins_del_ok 5575 && (!char_ins_del_ok
5576 || begmatch + endmatch <= char_ins_del_cost (frame)[nsp - osp])) 5576 || begmatch + endmatch <= char_ins_del_cost (f)[nsp - osp]))
5577 { 5577 {
5578 begmatch = 0; 5578 begmatch = 0;
5579 endmatch = 0; 5579 endmatch = 0;
@@ -5607,16 +5607,23 @@ update_frame_line (frame, vpos)
5607 tem = nsp + begmatch + endmatch; 5607 tem = nsp + begmatch + endmatch;
5608 if (nlen != tem || olen != tem) 5608 if (nlen != tem || olen != tem)
5609 { 5609 {
5610 cursor_to (vpos, nsp + begmatch);
5611 if (!endmatch || nlen == olen) 5610 if (!endmatch || nlen == olen)
5612 { 5611 {
5613 /* If new text being written reaches right margin, 5612 /* If new text being written reaches right margin, there is
5614 there is no need to do clear-to-eol at the end. 5613 no need to do clear-to-eol at the end of this function
5615 (and it would not be safe, since cursor is not 5614 (and it would not be safe, since cursor is not going to
5616 going to be "at the margin" after the text is done) */ 5615 be "at the margin" after the text is done). */
5617 if (nlen == FRAME_WINDOW_WIDTH (frame)) 5616 if (nlen == FRAME_WINDOW_WIDTH (f))
5618 olen = 0; 5617 olen = 0;
5619 write_glyphs (nbody + nsp + begmatch, nlen - tem); 5618
5619 /* Function write_glyphs is prepared to do nothing
5620 if passed a length <= 0. Check it here to avoid
5621 unnecessary cursor movement. */
5622 if (nlen - tem > 0)
5623 {
5624 cursor_to (vpos, nsp + begmatch);
5625 write_glyphs (nbody + nsp + begmatch, nlen - tem);
5626 }
5620 } 5627 }
5621 else if (nlen > olen) 5628 else if (nlen > olen)
5622 { 5629 {
@@ -5630,18 +5637,25 @@ update_frame_line (frame, vpos)
5630 int out = olen - tem; /* Columns to be overwritten originally. */ 5637 int out = olen - tem; /* Columns to be overwritten originally. */
5631 int del; 5638 int del;
5632 5639
5640 cursor_to (vpos, nsp + begmatch);
5641
5633 /* Calculate columns we can actually overwrite. */ 5642 /* Calculate columns we can actually overwrite. */
5634 while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out])) out--; 5643 while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out]))
5644 out--;
5635 write_glyphs (nbody + nsp + begmatch, out); 5645 write_glyphs (nbody + nsp + begmatch, out);
5646
5636 /* If we left columns to be overwritten, we must delete them. */ 5647 /* If we left columns to be overwritten, we must delete them. */
5637 del = olen - tem - out; 5648 del = olen - tem - out;
5638 if (del > 0) delete_glyphs (del); 5649 if (del > 0)
5650 delete_glyphs (del);
5651
5639 /* At last, we insert columns not yet written out. */ 5652 /* At last, we insert columns not yet written out. */
5640 insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del); 5653 insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del);
5641 olen = nlen; 5654 olen = nlen;
5642 } 5655 }
5643 else if (olen > nlen) 5656 else if (olen > nlen)
5644 { 5657 {
5658 cursor_to (vpos, nsp + begmatch);
5645 write_glyphs (nbody + nsp + begmatch, nlen - tem); 5659 write_glyphs (nbody + nsp + begmatch, nlen - tem);
5646 delete_glyphs (olen - nlen); 5660 delete_glyphs (olen - nlen);
5647 olen = nlen; 5661 olen = nlen;