all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: spacibba@aol.com, emacs-devel@gnu.org
Subject: Re: Question about display engine
Date: Tue, 13 Aug 2019 10:17:32 +0200	[thread overview]
Message-ID: <7ba80ec4-d7e2-1f69-5b55-00a8c1851cb4@gmx.at> (raw)
In-Reply-To: <831rxqtnaf.fsf@gnu.org>

 >> IIUC the last one found by face_at_buffer_position that explicitly
 >> specified a value for the attribute in question.  That is, the face
 >> whose attribute is actually used by the display engine.
 >
 > Nitpicking: the display engine has no idea whose attributes it is
 > using, see below.

In an earlier mail I labelled the display engine as "face agnostic" so
I am very well aware of that.  What I tried to point out (and failed)
so far is precisely how to work around that issue.

 > If two or more faces of those merged specify :underline, and only one
 > of them has a non-nil :extend, will extending the underline do what
 > the users expect?

It's the last face whose (1) :underline attribute is merged in _and_
whose (2) :extend attribute is set (nil or non-nil) that determines
whether the underline extends or not.  Whether that is what the users
expect is beyond my knowledge.  We can only try to provide a fairly
consistent way of specifying it.

 > (And shouldn't we simply disregard entirely a face whose :extend
 > attribute is nil?  What can such a face possibly contribute in this
 > case?)

Consider a user who sets the :extend attribute to non-nil for the
'default' face and wants a 'link' background to not extend to the end
of line.  Such a user would want to set the :extend attribute of the
'link' face to nil to get the desired effect.

 > You seem to assume that the iterator examines faces at every buffer
 > position it passes, and in particular on the newline at EOL.

I certainly do not assume such a thing.  But when trying to find out
how face attributes are merged and realized, face_at_buffer_position
was the first point of reference where I found that (and I still don't
know a better one).

 > But
 > that's not what happens, because examining and merging faces is
 > expensive, so Emacs avoids doing that unless necessary.  We only
 > examine faces where they change, and use next-single-property-change
 > to find the next position where we should again examine the faces.

That's exactly what I expected but did not find immediately.  If you
tell me where to look for that (Fnext_single_property_change _is_
called by face_at_buffer_position) "examine faces where they change"
and in particular where a :background change is found and applied, I
probably could tell you more.

 > In addition, face_at_buffer_position doesn't look for face attributes
 > one by one.  Instead, it finds all the source of the 'face' property
 > that are in effect at the given position -- the default face, the face
 > from text properties, and from all the overlays at that position --
 > and merges these attributes into a single attribute vector.  Then it
 > looks up a realized face with identical attributes, or realizes a new
 > face if no such face exists.  Thereafter, the iterator just uses that
 > face until the next checkpoint.  IOW, face_at_buffer_position returns
 > an ID of a realized (i.e. fully specified) face created by merging
 > several relevant sources of face information, and that realized face
 > has no references to the names of the individual faces from which it
 > was created, nor any memory of which non-unspecified attributes came
 > from which face source.

When face_at_buffer_position puts some 'background' value into that
single attribute vector, it can simply set an 'extend_background' bit
in that vector which tells the display engine whether the background
specified by that vector shall be extended or not.  Note that that
'extend_background' bit would be left alone when the face specifying
:background does not also specify :extend.  In that case the value of
:extend of the last face merged in that specified both would persist.

 > So to implement something like above, we will have to:
 >
 >   . force face merging when we get to a newline (btw, what about
 >     continuation lines in this context? do we apply the extension logic
 >     to them as well?)

I never show continuation lines (with exception of the minibuffer
where I have no choice) but I suppose we should apply the extension
there as well.  Think of the region spanning several continued lines.

 >   . modify face_at_buffer_position and its subroutines to behave
 >     specially when called on a newline,

I strongly doubt that this "called on a newline" is needed.  Setting
the 'extend_background' indicator is strongly tied to the last setting
of the 'background' indicator in the attribute vector as done by the
face merging algorithm.

 > and decide whether to merge or
 >     not merge attributes based on whatever data structures describe the
 >     preferences for extending those attributes; this would go at least
 >     two levels below face_at_buffer_position
 >   . do something similar in face_at_string_position, for display and
 >     overlay strings with embedded newlines
 >
 > Sounds like fun project.  Volunteers are welcome.

If all these were really necessary, I'd never vote for such a change.

martin



  parent reply	other threads:[~2019-08-13  8:17 UTC|newest]

Thread overview: 183+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07  0:54 Question about display engine Ergus
2019-08-07 15:01 ` Eli Zaretskii
2019-08-07 15:32   ` Ergus
2019-08-07 15:45     ` Eli Zaretskii
2019-08-07 15:57       ` Ergus
2019-08-07 16:12         ` Eli Zaretskii
2019-08-07 16:25           ` martin rudalics
2019-08-07 16:41             ` Eli Zaretskii
2019-08-08  7:25               ` martin rudalics
2019-08-08  8:38                 ` Ergus
2019-08-08  8:45                   ` martin rudalics
2019-08-08  9:29                     ` Ergus
2019-08-08 13:05                       ` martin rudalics
2019-08-08 13:59                         ` Eli Zaretskii
2019-08-08 16:43                           ` Ergus
2019-08-08 17:50                             ` Eli Zaretskii
2019-08-08 22:37                               ` Ergus
2019-08-09  6:28                                 ` Eli Zaretskii
2019-08-09  9:08                                   ` Ergus
2019-08-09  9:40                                     ` Eli Zaretskii
2019-08-09 11:31                                       ` Ergus
2019-08-09 14:04                                         ` Eli Zaretskii
2019-08-09 15:09                                           ` Ergus
2019-08-09  8:59                             ` martin rudalics
2019-08-09  9:31                               ` Ergus
2019-08-09  9:38                               ` Ergus
2019-08-10 11:42                             ` Eli Zaretskii
2019-08-11  8:14                               ` martin rudalics
2019-08-09  8:59                           ` martin rudalics
2019-08-08 14:50                         ` Ergus
2019-08-09  8:59                           ` martin rudalics
2019-08-10 11:30                             ` Eli Zaretskii
2019-08-11  8:14                               ` martin rudalics
2019-08-11 14:13                                 ` Eli Zaretskii
2019-08-12  8:59                                   ` martin rudalics
2019-08-12 15:29                                     ` Eli Zaretskii
2019-08-12 22:18                                       ` Stefan Monnier
2019-08-13  8:17                                         ` martin rudalics
2019-08-13 15:32                                           ` Eli Zaretskii
2019-08-13 22:33                                             ` Stefan Monnier
2019-08-14  8:58                                             ` martin rudalics
2019-08-13  8:17                                       ` martin rudalics [this message]
2019-08-13 15:31                                         ` Eli Zaretskii
2019-08-14  8:58                                           ` martin rudalics
2019-08-14 15:14                                             ` Eli Zaretskii
2019-08-15  8:13                                               ` martin rudalics
2019-08-15 15:18                                                 ` Eli Zaretskii
2019-08-16  7:29                                                   ` martin rudalics
2019-08-16  8:34                                                     ` Eli Zaretskii
2019-08-17  8:25                                                       ` martin rudalics
2019-08-19 16:13                                                         ` Ergus
2019-08-19 16:50                                                           ` Eli Zaretskii
2019-08-19 21:30                                                             ` Ergus
2019-08-20 14:09                                                               ` Eli Zaretskii
2019-08-25 10:22                                                                 ` Ergus
2019-08-25 10:44                                                                   ` Eli Zaretskii
2019-08-26  4:31                                                                     ` Ergus
2019-08-26  7:45                                                                       ` Eli Zaretskii
2019-08-26  8:18                                                                         ` Ergus
2019-08-26  9:49                                                                           ` Eli Zaretskii
2019-08-27 22:20                                                                             ` Ergus
2019-08-28  8:35                                                                               ` martin rudalics
2019-08-28  9:07                                                                                 ` Eli Zaretskii
2019-08-28 12:19                                                                                   ` martin rudalics
2019-08-28 16:31                                                                                     ` Ergus
2019-08-28 17:24                                                                                       ` Eli Zaretskii
2019-08-28 18:19                                                                                         ` Ergus
2019-08-29 18:28                                                                                           ` Eli Zaretskii
2019-08-30  7:02                                                                                             ` martin rudalics
2019-08-30  7:26                                                                                               ` Eli Zaretskii
2019-08-30  9:34                                                                                             ` Ergus
2019-08-29  7:45                                                                                       ` martin rudalics
2019-08-28 17:21                                                                                     ` Eli Zaretskii
2019-08-29  7:45                                                                                       ` martin rudalics
2019-08-29 18:36                                                                                         ` Eli Zaretskii
2019-08-30  7:03                                                                                           ` martin rudalics
2019-08-30  8:48                                                                                             ` Eli Zaretskii
2019-08-31  7:29                                                                                               ` martin rudalics
2019-08-31  7:57                                                                                                 ` Eli Zaretskii
2019-09-01  8:14                                                                                                   ` martin rudalics
2019-09-01 12:26                                                                                                     ` Ergus
2019-09-02  8:36                                                                                                       ` martin rudalics
2019-09-02 11:05                                                                                                         ` Ergus
2019-09-02 16:18                                                                                                           ` Eli Zaretskii
2019-09-03  5:33                                                                                                             ` Ergus
2019-09-03  8:45                                                                                                               ` martin rudalics
2019-09-03 11:23                                                                                                                 ` Ergus
2019-09-03 12:17                                                                                                                   ` martin rudalics
2019-09-03 14:56                                                                                                                   ` Eli Zaretskii
2019-09-03  5:35                                                                                                             ` Ergus via Emacs development discussions.
2019-09-03  8:45                                                                                                             ` martin rudalics
2019-09-03 14:53                                                                                                               ` Eli Zaretskii
2019-09-03 16:41                                                                                                                 ` martin rudalics
2019-09-03 17:31                                                                                                                   ` Eli Zaretskii
2019-09-03 18:59                                                                                                                     ` martin rudalics
2019-09-04 18:33                                                                                                                       ` Ergus
2019-09-04 20:04                                                                                                                         ` martin rudalics
2019-09-04 20:19                                                                                                                           ` Ergus via Emacs development discussions.
2019-09-05  7:32                                                                                                                             ` martin rudalics
2019-09-05 13:54                                                                                                                               ` Ergus
2019-09-05 19:31                                                                                                                                 ` Ergus
     [not found]                                                                                                                           ` <1826922767.1725310.1567682307734@mail.yahoo.com>
2019-09-05 11:18                                                                                                                             ` Ergus
2019-08-21  7:37                                                           ` martin rudalics
2019-08-08 17:37                   ` Eli Zaretskii
2019-08-09 12:46                     ` martin rudalics
2019-08-10 11:25                       ` Eli Zaretskii
2019-08-10 23:04                         ` Stefan Monnier
2019-08-11  2:43                           ` Eli Zaretskii
2019-08-11  8:17                             ` martin rudalics
2019-08-11  8:11                         ` martin rudalics
2019-08-08 17:38                   ` Eli Zaretskii
2019-08-08  8:15               ` Ergus
2019-08-08  8:45                 ` martin rudalics
2019-08-08  9:17                   ` Ergus
2019-08-08 17:35                 ` Eli Zaretskii
2019-08-08 20:37                 ` Juri Linkov
2019-08-08 22:24                   ` Ergus
2019-08-09  6:42                     ` Eli Zaretskii
2019-08-09 17:54                     ` Juri Linkov
  -- strict thread matches above, loose matches on Subject: below --
2019-08-27 16:01 Keith David Bershatsky
     [not found] <318675867.1913640.1567711569517.ref@mail.yahoo.com>
2019-09-05 19:26 ` Ergus
2019-09-06  8:22   ` martin rudalics
2019-09-06  9:31     ` Ergus
2019-09-07  6:52       ` martin rudalics
2019-09-07  7:37         ` Eli Zaretskii
2019-09-07  7:55           ` Eli Zaretskii
2019-09-08  0:51             ` Ergus via Emacs development discussions.
2019-09-08  8:40               ` martin rudalics
2019-09-08 12:53                 ` Ergus
2019-09-09  7:39                   ` martin rudalics
2019-09-09 13:56                     ` Ergus
2019-09-09 16:00                     ` Eli Zaretskii
2019-09-09 17:08                       ` Ergus
2019-09-09 18:08                         ` Eli Zaretskii
2019-09-09 19:29                           ` Ergus
2019-09-10  2:27                             ` Eli Zaretskii
2019-09-12  3:37                               ` Ergus
2019-09-13  8:50                                 ` Eli Zaretskii
2019-09-08 17:51               ` Eli Zaretskii
2019-09-08 18:23                 ` Ergus
2019-09-14 20:42                   ` Ergus
2019-09-15  8:25                     ` martin rudalics
2019-09-15 11:26                       ` Ergus
2019-09-15 12:22                         ` martin rudalics
2019-09-15 14:28                           ` Stefan Monnier
2019-09-16  9:05                             ` martin rudalics
2019-09-15 15:32                     ` Eli Zaretskii
2019-09-15 21:42                       ` Ergus
2019-09-17  2:17                         ` Ergus
2019-09-17  9:48                           ` Eli Zaretskii
2019-09-21  8:20                             ` Eli Zaretskii
2019-09-21 13:57                               ` Ergus
2019-09-21 21:55                               ` Ergus
2019-09-26 16:32                                 ` Ergus
2019-09-28 10:35                                   ` Eli Zaretskii
2019-09-29 10:30                                     ` Ergus
2019-09-29 10:57                                       ` Eli Zaretskii
2019-10-07 15:40                                         ` Ergus
2019-10-09  9:02                                           ` Eli Zaretskii
2019-10-12 18:16                                             ` Ergus
2019-10-12 18:29                                               ` Eli Zaretskii
2019-09-06  8:55   ` Eli Zaretskii
2019-09-06 10:30     ` Ergus
2019-09-06 13:28       ` Eli Zaretskii
2019-09-06 16:34         ` Ergus
2019-09-06 18:12           ` Eli Zaretskii
2019-09-07  2:35             ` Ergus
2019-09-07  6:41               ` Eli Zaretskii
     [not found] <20191012222305.jpjinkd5y2lz6xiv@Ergus>
     [not found] ` <83mue5kmfx.fsf@gnu.org>
2019-10-13 15:40   ` Ergus
2019-10-13 16:06     ` Eli Zaretskii
2019-10-13 16:44       ` Ergus
2019-10-13 17:04         ` Eli Zaretskii
2019-10-13 18:11           ` Ergus
2019-10-13 18:25           ` Ergus
2019-10-13 18:53             ` Eli Zaretskii
2019-10-13 19:38               ` Ergus
2019-10-13 21:01                 ` Eli Zaretskii
2019-10-13 22:27                   ` Ergus
2019-10-14  8:26                     ` Eli Zaretskii
2019-10-20 22:20                       ` Ergus
2019-10-21  6:38                         ` Eli Zaretskii
2019-10-13 19:41               ` Ergus
2019-10-13 16:11     ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=7ba80ec4-d7e2-1f69-5b55-00a8c1851cb4@gmx.at \
    --to=rudalics@gmx.at \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=spacibba@aol.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.