aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Möllmann2024-10-23 09:55:26 +0200
committerGerd Möllmann2024-10-23 10:02:05 +0200
commitd1fd1d8fba8a6cfe774f6982bb6ad6c874d0c960 (patch)
tree7fd7458d521def7582fe7fc08333a22e346a24f9
parent669586a5e795d84436960aa6ef1a26532df63573 (diff)
downloademacs-d1fd1d8fba8a6cfe774f6982bb6ad6c874d0c960.tar.gz
emacs-d1fd1d8fba8a6cfe774f6982bb6ad6c874d0c960.zip
Deal with wide characters
* src/dispnew.c (make_glyph_space): New function. (neutralize_wide_char): New function. (produce_box_sides, copy_child_glyphs): Call neutralize_wide_char.
-rw-r--r--src/dispnew.c58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 9a41b6be578..6a6f983a2ce 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3513,6 +3513,45 @@ prepare_desired_root_row (struct frame *root, int y)
3513 return root_row; 3513 return root_row;
3514} 3514}
3515 3515
3516/* Change GLYPH to be a space glyph. */
3517
3518static void
3519make_glyph_space (struct glyph *glyph)
3520{
3521 glyph->u.ch = ' ';
3522 glyph->pixel_width = 1;
3523 glyph->padding_p = 0;
3524}
3525
3526/* On root frame ROOT, if the glyph in ROW at position X is part of a
3527 sequence of glyphs for a wide character, change every glyph belonging
3528 to the sequence to a space. If X is outside of ROOT, do nothing. */
3529
3530static void
3531neutralize_wide_char (struct frame *root, struct glyph_row *row, int x)
3532{
3533 if (x < 0 || x >= root->desired_matrix->matrix_w)
3534 return;
3535
3536 struct glyph *glyph = row->glyphs[0] + x;
3537 if (glyph->type == CHAR_GLYPH && CHARACTER_WIDTH (glyph->u.ch) > 1)
3538 {
3539 struct glyph *row_start = row->glyphs[0];
3540 struct glyph *row_limit = row_start + row->used[0];
3541
3542 /* Glyph is somewhere in a sequence of glyphs for a wide
3543 character, find the start. */
3544 while (glyph > row_start && glyph->padding_p)
3545 --glyph;
3546
3547 /* Make everything in the sequence a space glyph. */
3548 eassert (!glyph->padding_p);
3549 make_glyph_space (glyph);
3550 for (++glyph; glyph < row_limit && glyph->padding_p; ++glyph)
3551 make_glyph_space (glyph);
3552 }
3553}
3554
3516/* Produce glyphs for box character BOX in ROW. X is the position in 3555/* Produce glyphs for box character BOX in ROW. X is the position in
3517 ROW where to start producing glyphs. N is the number of glyphs to 3556 ROW where to start producing glyphs. N is the number of glyphs to
3518 produce. CHILD is the frame to use for the face of the glyphs. */ 3557 produce. CHILD is the frame to use for the face of the glyphs. */
@@ -3582,9 +3621,16 @@ produce_box_sides (enum box left, enum box right, struct glyph_row *root_row, in
3582 int w, struct frame *root, struct frame *child) 3621 int w, struct frame *root, struct frame *child)
3583{ 3622{
3584 if (x > 0) 3623 if (x > 0)
3585 produce_box_glyphs (left, root_row, x - 1, 1, child); 3624 {
3625 neutralize_wide_char (root, root_row, x - 1);
3626 produce_box_glyphs (left, root_row, x - 1, 1, child);
3627 }
3628
3586 if (x + w < root->desired_matrix->matrix_w) 3629 if (x + w < root->desired_matrix->matrix_w)
3587 produce_box_glyphs (right, root_row, x + w, 1, child); 3630 {
3631 neutralize_wide_char (root, root_row, x + w);
3632 produce_box_glyphs (right, root_row, x + w, 1, child);
3633 }
3588} 3634}
3589 3635
3590static void 3636static void
@@ -3648,6 +3694,14 @@ copy_child_glyphs (struct frame *root, struct frame *child)
3648 { 3694 {
3649 struct glyph_row *root_row = prepare_desired_root_row (root, y); 3695 struct glyph_row *root_row = prepare_desired_root_row (root, y);
3650 3696
3697 /* Deal with wide characters unless already done as part of
3698 drawing a box around the child frame. */
3699 if (FRAME_UNDECORATED (child))
3700 {
3701 neutralize_wide_char (root, root_row, r.x - 1);
3702 neutralize_wide_char (root, root_row, r.x + r.w);
3703 }
3704
3651 /* Copy what's visible from the child's current row. */ 3705 /* Copy what's visible from the child's current row. */
3652 struct glyph_row *child_row = MATRIX_ROW (child->current_matrix, child_y); 3706 struct glyph_row *child_row = MATRIX_ROW (child->current_matrix, child_y);
3653 memcpy (root_row->glyphs[0] + r.x, child_row->glyphs[0] + child_x, 3707 memcpy (root_row->glyphs[0] + r.x, child_row->glyphs[0] + child_x,