unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 50660@debbugs.gnu.org
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 20:12:55 +0800	[thread overview]
Message-ID: <87lf2tdv7c.fsf@yahoo.com> (raw)
In-Reply-To: <83wnmdgtzg.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 16 Oct 2021 13:10:59 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

> So what happens here is that s->face is computed from the face of the
> glyphs which "belong" to the glyph string s.  That face comes from the
> glyph matrix which holds the glyphs.  That face was computed by
> redisplay_window using FACE_FOR_CHAR, see get_next_display_element, so
> it's the face at the character's buffer position adjusted for the font
> suitable for the character at the cursor.  Now you want to display
> that same character, but with the mouse-face.  FACE_FROM_ID gives you
> that face, but it is for ASCII characters.  So you call FACE_FOR_CHAR
> again, to obtain the mouse face adjusted for the font suitable for
> displaying the character at the cursor.
>
> The above sounds correct to me, so I don't understand why you want to
> ignore the font of the face produced by FACE_FOR_CHAR.  What am I
> missing?

The problem occurs when (adjusted_mouse_face)->font has different
metrics from the font originally used to display each glyph.

(For instance, if mouse face is `highlight' but the original face was
`custom-group-tag', which is variable pitch and has a much larger font
size than `highlight')

In this case, the text will be drawn with the wrong font for its
existing metrics!  If the mouse face has larger dimensions than the
original face, it will extend past the boundaries of the original text,
and if they are smaller, then the text will not be enough to fill the
original text.

And regardless of the relative dimensions of either faces, cursor
position will be even more incorrect.

> Yes.  Btw, it would probably be cleaner to add an extra argument to
> get_glyph_face_and_encoding, but make that argument be a pointer to
> 'struct face', not just an indication of which face to use.

Noted, thanks.

> What was that second issue about? why did you need to change the
> inequality?

get_cursor_offset_for_mouse_face was including the glyph under the
cursor in its offset calculations, which is invalid.





  reply	other threads:[~2021-10-16 12:12 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87czp6ysw7.fsf.ref@yahoo.com>
2021-09-18 12:23 ` bug#50660: 28.0.50; Text artifacting when the cursor moves over text under mouse face that originally displayed a box Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-18 13:48   ` Lars Ingebrigtsen
2021-09-19  0:33     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-19  5:47       ` Eli Zaretskii
2021-09-19 13:55         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-19 15:13           ` Lars Ingebrigtsen
2021-09-19 17:01           ` Eli Zaretskii
2021-09-20  1:00             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-20  5:19               ` Eli Zaretskii
2021-09-20  5:34                 ` Eli Zaretskii
2021-09-20  8:02                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-20  7:07                 ` Eli Zaretskii
2021-09-20  7:34                   ` Eli Zaretskii
2021-09-20  8:18                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-20  9:47                       ` Eli Zaretskii
2021-09-20 10:27                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-20 10:51                           ` Eli Zaretskii
2021-09-20 11:08                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-20 12:07                               ` Eli Zaretskii
2021-09-20 12:36                               ` Eli Zaretskii
2021-09-21  0:38                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21  6:11                                   ` Eli Zaretskii
2021-09-21  7:34                                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21  8:45                                       ` Eli Zaretskii
2021-09-21  9:20                                         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21  9:37                                           ` Eli Zaretskii
2021-09-21  9:45                                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21 10:17                                               ` Eli Zaretskii
2021-09-21 10:41                                                 ` Eli Zaretskii
2021-09-21 12:26                                                   ` Eli Zaretskii
2021-09-20 11:09                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21 12:46                             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21 13:10                               ` Eli Zaretskii
2021-09-21 13:36                                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21 13:47                                   ` Eli Zaretskii
2021-09-23 23:53                                     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-24  6:47                                       ` Eli Zaretskii
2021-09-26  6:46                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-26  7:04                                         ` Eli Zaretskii
2021-09-26  9:56                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-27 11:52                                             ` Eli Zaretskii
2021-09-29  1:35                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-02  8:43                                                 ` Eli Zaretskii
2021-10-02  9:46                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-02 12:52                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-14  8:58                                                     ` Eli Zaretskii
2021-10-14 10:52                                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-14 11:11                                                         ` Robert Pluim
2021-10-14 11:25                                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-14 11:35                                                         ` Eli Zaretskii
2021-10-14 11:54                                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-14 12:10                                                             ` Eli Zaretskii
2021-10-14 12:16                                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-14 12:20                                                                 ` Eli Zaretskii
2021-10-14 12:27                                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-14 12:44                                                                     ` Eli Zaretskii
2021-10-14 13:11                                                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-14 15:51                                                                         ` Eli Zaretskii
2021-10-15  1:28                                                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-15 13:43                                                                             ` Eli Zaretskii
2021-10-16  0:18                                                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-16  6:09                                                                                 ` Eli Zaretskii
2021-10-16  6:16                                                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-16  6:28                                                                                     ` Eli Zaretskii
2021-10-16  6:39                                                                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-16  7:00                                                                                         ` Eli Zaretskii
2021-10-16  7:13                                                                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-16  7:26                                                                                             ` Eli Zaretskii
2021-10-16  7:52                                                                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-16 10:10                                                                                                 ` Eli Zaretskii
2021-10-16 12:12                                                                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-10-16 12:25                                                                                                     ` Eli Zaretskii
2021-10-16 12:36                                                                                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-16 12:45                                                                                                         ` Eli Zaretskii
2021-10-16 13:18                                                                                                           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-16 13:46                                                                                                             ` Eli Zaretskii
2021-10-17  0:32                                                                                                               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-17 12:15                                                                                                                 ` Eli Zaretskii
2021-10-17 12:39                                                                                                                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-20  8:02                 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-20  6:33               ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-19  0:50     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-19 15:10       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lf2tdv7c.fsf@yahoo.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=50660@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).