From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#50660: 28.0.50; Text artifacting when the cursor moves over text under mouse face that originally displayed a box Date: Sat, 16 Oct 2021 14:39:58 +0800 Message-ID: <87y26tfp6p.fsf@yahoo.com> References: <87czp6ysw7.fsf.ref@yahoo.com> <87k0j0rwo3.fsf@yahoo.com> <838rzbddfa.fsf@gnu.org> <878rzbd1w5.fsf@yahoo.com> <83wnmgkmok.fsf@gnu.org> <878ryvnain.fsf@yahoo.com> <83mtnbltyp.fsf@gnu.org> <87mtnblt35.fsf@yahoo.com> <83ilxzlsck.fsf@gnu.org> <877defls2w.fsf@yahoo.com> <83fst3lrwr.fsf@gnu.org> <87o87rkczt.fsf@yahoo.com> <83czo7lqrl.fsf@gnu.org> <87h7djkayk.fsf@yahoo.com> <83bl3rli53.fsf@gnu.org> <871r4njcum.fsf@yahoo.com> <83v91yiesj.fsf@gnu.org> <8735p1izzi.fsf@yahoo.com> <83k0idijq9.fsf@gnu.org> <87lf2th4ur.fsf@yahoo.com> <83fst1iivf.fsf@gnu.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36816"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: larsi@gnus.org, 50660@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 16 08:41:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbdNW-0009LB-2k for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Oct 2021 08:41:10 +0200 Original-Received: from localhost ([::1]:35492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mbdNU-0000Dr-VP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Oct 2021 02:41:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mbdNO-0000Dh-HF for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2021 02:41:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57504) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mbdNO-0001Lq-68 for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2021 02:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mbdNN-00036E-UQ for bug-gnu-emacs@gnu.org; Sat, 16 Oct 2021 02:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Oct 2021 06:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50660 X-GNU-PR-Package: emacs Original-Received: via spool by 50660-submit@debbugs.gnu.org id=B50660.163436641611854 (code B ref 50660); Sat, 16 Oct 2021 06:41:01 +0000 Original-Received: (at 50660) by debbugs.gnu.org; 16 Oct 2021 06:40:16 +0000 Original-Received: from localhost ([127.0.0.1]:40816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbdMe-000357-8s for submit@debbugs.gnu.org; Sat, 16 Oct 2021 02:40:16 -0400 Original-Received: from sonic315-22.consmr.mail.ne1.yahoo.com ([66.163.190.148]:33316) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mbdMb-00034o-8O for 50660@debbugs.gnu.org; Sat, 16 Oct 2021 02:40:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1634366407; bh=vaNV6YZvzwQBsGKyox4I+cXFgZmD4sAR+Bi3pFP0jiI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=RYbv/Q8EvMnADDmVmGLqT2ibePGxtQb8LysgxaC1ZpuBlrlfd6DkZWkWfE2EDKMwKDXRznKfyeImk5HrS6gfBCY7YVrc38M8zHWSYssXs3GfVizjSl5U0FBqBk2NIexWyOh/yI7cH9KqL2IbDYPl0J0TxJc4DBriDW9b6b7DVhL4s505ABKKTKr6tw/FGSBdgw5MiLKHU7M5smBSdO/G4RCxIPsEk8s2V5fDz5idMi/5iYy325RAKknYJAES3yUHAgulnCVAjSvk8tPA1e5Fr/KM+wQQ2BVXLROiykuXaHRlFaRwab8aZL8w7EtpehBbHGaOUS4WY1QouZZ/0ZF2ww== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1634366407; bh=xwhNxBt1cu0L6ev5s05YdRkGeKVCGD3z4b2W+T2Aeox=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=LV/ELdw44TCED0qYXmG7KQ6UP5ggCnmCtcqyPtzDGHO8f2k2FOvXDCLwkEj1imyvCWgOzdNTyG5e7+sn3RMl/by+xyhhFzJKcquYOMJeuwmYSPUz7Q0WriK9HdCLomK0KJjLWmEDvufZokZt0FhBFLzipxxlqVs3Wg/+Tb9Jus9tIvyqDxG++w+6/gRF5Tv0aZ29gEz52oUKxbZPVt26ARZDRg76GWJWRnfVXXTEI8c723TMwqtYXXPY8TBKABfIehTp4I00L7qwVukTADNsoZ7KYfQkxq2LwvPO2D/IWuM7ugkNA38sM3I19Up4HNyMQDxV29kUprjEUWUNGLhc5g== X-YMail-OSG: fEMi62UVM1mjUc2QW_FeTr34n3TkE5VW7gbalZRfp841j9KhjMDIh5kA3.84RpB eYC0D.LitWHqqb.pgR8P7DTSET_Wj6XlqXCx6FSaBOXO_T4qvd6KZPM7EBsYUNxqikVjKyplKig9 lHcupG1ZO7dxPAp1tFlVFpyxYYaX2yAOSjmdhGYGMGXt_Q0X0_uRgysLeRF7WURVD5ZeDHwdhD.O vAZ7wzxFvA23KOlHP9PX2.eVz_.V4b.L7D.C6xQIU5Tma8LbAR90WnrA3CngVYwzm2pBWj8qsyw6 Hl.6En9ejwl8LKAyawUiS7rSY9EMJ7q3Aw6Jc8OaXvssOiEi0ZAa0ihJ2s7edWbYudOyUP2A._jH 7xd.Mgbg_Q3W8..Dw_XR5GnGKb41zhjr.Mo05zUIYN2HPRhCEHr1CB8exkLASXjvKJzwllC_UODj iV1bjktPf15tXGp1niIYCKRhucBqmtljgcu881uG3F0bIW8nhM0qPzc_FOEH7uwUBVJzMZka236Z AzMAGSHK8TGkUNaXHkg0rNTuAd48j9tH21YvIiSky3b1ehc0_BVTKX5jWXuRogxwq5GP7wNG.IV1 ispYpQ8_IaWU9JCiztdTlA9B7y8v2Los_Rse0qSOSPMw4TZZkESkW.uw6brwCC_1ncsHIs3e7LAf y1uGLirtEqK3MaSQxbhJO_c.fhqELB0wb1fKcNyj4cgUCk96ilLKoxl0Vf.4BTEegOxC6aI7qrpY s0Sfjrg1JfXqBsH1f3.0JwIcF2s9XSnahz0i6fyJ.d376v7eEfe4GdEPjeqKf7DEXWHtmDKYXZr3 ZKfD_Yvorpf_0tZt001RfYezSQlzZCFoR7fX0QGVZv X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.ne1.yahoo.com with HTTP; Sat, 16 Oct 2021 06:40:07 +0000 Original-Received: by kubenode504.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 38796a9720ce2ba35a4900b8d5c59d81; Sat, 16 Oct 2021 06:40:02 +0000 (UTC) In-Reply-To: <83fst1iivf.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 16 Oct 2021 09:28:04 +0300") X-Mailer: WebService/1.1.19116 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:217344 Archived-At: Eli Zaretskii writes: >> I meant what it should be after the processing, and by "the original >> font", I meant the font of the original face, that was used to calculate >> the metrics of the glyphs. > FACE_FOR_CHAR will get you the face with the correct font, and calling > get_glyph_face_and_encoding after that will produce the glyph codes > from that font. So that's exactly why I commented why your additional > code must be before the loop that produces the glyph codes (inside > get_glyph_face_and_encoding). We might be misunderstanding something: I'm asking whether to arrange fill_glyph_string like such: /* The loop with get_glyph_face_and_encoding is above this comment */ s->font = s->face->font; if (s->hl == DRAW_MOUSE_FACE || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w))) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (s->f); struct face *face = FACE_FROM_ID (s->f, hlinfo->mouse_face_face_id); s->face = FACE_FROM_ID (s->f, FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch, -1, Qnil)); } Or like such: /* get_glyph_face_and_encoding is modified to produce glyphs with the mouse face in the loop here. */ while (glyph < last && glyph->type == CHAR_GLYPH && glyph->voffset == voffset /* Same face id implies same font, nowadays. */ && glyph->face_id == face_id && glyph->glyph_not_available_p == glyph_not_available_p) { s->face = get_glyph_face_and_encoding (s->f, glyph, s->char2b + s->nchars, /* This argument controls whether or not get_glyph_face_and_encoding uses the mouse face */ (s->hl == DRAW_MOUSE_FACE || (s->hl == DRAW_CURSOR && cursor_in_mouse_face_p (s->w))); ++s->nchars; eassert (s->nchars <= end - start); s->width += glyph->pixel_width; if (glyph++->padding_p != s->padding_p) break; } s->font = s->face->font; I think the first situation will work better, because we want the mouse face to be drawn with the font that the regular face is under, not the font of the mouse face. This is how the old code in *term.c used to behave, and prevents the text from being drawn with a font (font, not face) that has metrics different from that of the mouse face's font.