all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alp Aker <alp.tekin.aker@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Fill column indicator functionality
Date: Sun, 17 Mar 2019 13:28:22 -0400	[thread overview]
Message-ID: <23c888a1-66ba-5f98-cd32-567457af84d8@gmail.com> (raw)
In-Reply-To: <83y35fxawz.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 4486 bytes --]

>> In graphical interfaces the space after the line is always filled with
>> the background color of the face of the last produced glyph, even if I
>> reset it to the saved value after the generation. The only solution I
>> found so far was to add an extra glyph after reset the face to the
>> default (saved) value, but hopefully there is a better way?
> I don't think I understand what face is "the face of the last produced
> glyph".  is that the face of the indicator character, is that the
> default face, or is that something else?  Can you show a screenshot?
I noticed an issue with non-default backgrounds that span newlines, such 
as happens with region highlighting. I believe I ran into what Ergus is 
describing while working on a fix (see (3) below).  The version of the 
code I looked at was 9dcaa15e5a, from Ergus's Github repo.

You can see the issue with non-default backgrounds in the attached 
screenshots mode-off.png and mode-on.png; activating 
display-fill-column-indicator-mode truncates the highlighting on each 
line.  To fix:

1. The stretch glyph needs to be drawn in the current face, not the 
fill_column face.

2. The default fill-column face should have an unspecified background 
and it should be merged into the current face during display, not into 
the default face.

3. If the fill-column face specifies a background, we need to reset the 
face to the saved face after producing the indicator glyph. Here I found 
it necessary to insert another display element in order for the face 
change to take effect before the background is extended to the end of 
the line. (I used a 0-width stretch glyph.)  Without that, the 
fill-column face is used (see the attached c.png for a screenshot).  I 
believe this need to add another display element at the end of the line 
is what Ergus was asking about.


diff --git a/lisp/faces.el b/lisp/faces.el
index 153e6a208f..6b9980a77f 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2504,7 +2504,7 @@ line-number-current-line

  ;; Definition stolen from linum.el.
  (defface fill-column
-  '((t :inherit (shadow default)))
+  '((t :inherit (shadow)))
    "Face for displaying fill column indicator line.
  This face is used when `display-fill-column-indicator-mode' is
  non-nil.

diff --git a/src/xdisp.c b/src/xdisp.c
index 8ac4be8dc7..7c4f9889eb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -20416,21 +20416,23 @@ extend_face_to_end_of_line (struct it *it)
            int stretch_ascent = (((it->ascent + it->descent)
              * FONT_BASE (font)) / FONT_HEIGHT (font));

-          it->char_to_display = 
XFIXNAT(Vdisplay_fill_column_indicator_character);
            memset (&it->position, 0, sizeof it->position);
            it->avoid_cursor_p = true;
-          it->face_id = merge_faces (it->w, Qfill_column, 0, 
DEFAULT_FACE_ID);
            it->start_of_box_run_p = false;
            it->object = Qnil;

            append_stretch_glyph (it, Qnil, stretch_width,
                                  it->ascent + it->descent, stretch_ascent);

+          it->char_to_display = 
XFIXNAT(Vdisplay_fill_column_indicator_character);
+          it->face_id = merge_faces (it->w, Qfill_column, 0, 
saved_face_id);
            PRODUCE_GLYPHS (it);

+          it->face_id = saved_face_id;
+          append_stretch_glyph (it, Qnil, 0, it->ascent + it->descent,
+                             stretch_ascent);
            it->position = saved_pos;
            it->avoid_cursor_p = saved_avoid_cursor;
-          it->face_id = saved_face_id;
            it->start_of_box_run_p = saved_box_start;
            it->char_to_display = saved_char;
            it->object = save_object;
@@ -20566,7 +20568,7 @@ extend_face_to_end_of_line (struct it *it)
            if (it->current_x == fill_column_indicator_line)
              {
            const int saved_face = it->face_id;
-          it->face_id = merge_faces (it->w, Qfill_column, 0, 
DEFAULT_FACE_ID);
+          it->face_id = merge_faces (it->w, Qfill_column, 0, saved_face);
            it->c = it->char_to_display = 
XFIXNAT(Vdisplay_fill_column_indicator_character);
            PRODUCE_GLYPHS (it);
            it->face_id = saved_face;


[-- Attachment #2: c.png --]
[-- Type: image/png, Size: 34786 bytes --]

[-- Attachment #3: mode-on.png --]
[-- Type: image/png, Size: 48715 bytes --]

[-- Attachment #4: mode-off.png --]
[-- Type: image/png, Size: 47731 bytes --]

  reply	other threads:[~2019-03-17 17:28 UTC|newest]

Thread overview: 196+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 10:53 Fill column indicator functionality Ergus
2019-02-05 16:41 ` Eli Zaretskii
2019-02-05 18:47   ` Ergus
2019-02-05 19:56     ` Drew Adams
2019-02-05 23:32       ` Ergus
2019-02-06 16:08     ` Eli Zaretskii
2019-02-06 20:48       ` John Yates
2019-02-06 22:25         ` Ergus
2019-02-07  1:41           ` Basil L. Contovounesios
2019-02-07 14:31             ` Eli Zaretskii
2019-02-10 22:04               ` Ergus
2019-02-11 15:55                 ` Eli Zaretskii
2019-02-11 16:56                   ` Jimmy Aguilar Mena
2019-02-11 17:13                     ` Eli Zaretskii
2019-03-08 18:57                       ` Ergus
2019-03-08 20:06                         ` Eli Zaretskii
2019-03-09 13:22                           ` Ergus
2019-03-09 14:10                             ` Eli Zaretskii
2019-03-11 10:48                               ` Ergus
2019-03-11 15:30                                 ` Eli Zaretskii
2019-03-11 19:58                                   ` Andy Moreton
2019-03-11 20:24                                     ` Eli Zaretskii
2019-03-12 15:29                                   ` Ergus
2019-03-12 16:19                                     ` Eli Zaretskii
2019-03-12 19:20                                       ` Ergus
2019-03-13 16:19                                         ` Eli Zaretskii
2019-03-13 20:02                                           ` Ergus
2019-03-13 20:09                                             ` Eli Zaretskii
2019-03-14  3:02                                               ` Ergus
2019-03-14  6:40                                                 ` Eli Zaretskii
2019-03-14 16:51                                                   ` Ergus
2019-03-14 17:59                                                     ` Andreas Schwab
2019-03-14 18:22                                                     ` Eli Zaretskii
     [not found]                                                       ` <20190314211313.giyz7p6jtmquabea@Ergus>
     [not found]                                                         ` <83bm2c1smi.fsf@gnu.org>
2019-03-15 20:56                                                           ` Ergus
2019-03-15 22:52                                                             ` Óscar Fuentes
2019-03-15 23:22                                                               ` Ergus
2019-03-15 23:47                                                                 ` Óscar Fuentes
2019-03-16  6:50                                                                   ` Ergus
2019-03-16  7:48                                                                 ` Eli Zaretskii
2019-03-16  7:42                                                               ` Eli Zaretskii
2019-03-16 12:26                                                             ` Eli Zaretskii
2019-03-17 17:28                                                               ` Alp Aker [this message]
2019-03-17 18:03                                                                 ` Ergus
2019-03-17 18:40                                                                 ` Eli Zaretskii
2019-03-16  9:36                                                           ` Ergus
2019-03-16 10:18                                                             ` Question about documented functions Ergus
2019-03-16 12:21                                                               ` Eli Zaretskii
2019-03-16 13:53                                                                 ` Ergus
2019-03-16 14:05                                                                   ` Eli Zaretskii
2019-03-16 12:40                                                             ` Fill column indicator functionality Eli Zaretskii
2019-03-14 21:28                                                     ` Óscar Fuentes
2019-03-14 23:54                                                       ` Ergus
2019-03-14 18:58                                                   ` Clément Pit-Claudel
2019-03-15  7:30                                                     ` Eli Zaretskii
2019-03-15 12:44                                                       ` Clément Pit-Claudel
2019-03-15 14:07                                                         ` Óscar Fuentes
2019-03-15 14:54                                                           ` Clément Pit-Claudel
2019-03-15 15:15                                                             ` Óscar Fuentes
2019-03-15 15:30                                                               ` Clément Pit-Claudel
2019-03-15 14:12                                                         ` Eli Zaretskii
2019-03-15 14:35                                                           ` Clément Pit-Claudel
2019-03-15 16:13                                                             ` Eli Zaretskii
2019-03-15 18:26                                                               ` Clément Pit-Claudel
2019-03-15 19:14                                                                 ` Eli Zaretskii
2019-03-15 15:13                                                         ` Stefan Monnier
2019-03-15 13:00                                                       ` Alp Aker
2019-03-15 13:30                                                         ` Mattias Engdegård
2019-03-15 14:24                                                           ` Eli Zaretskii
2019-03-15 15:05                                                             ` Mattias Engdegård
2019-03-15 15:54                                                               ` Eli Zaretskii
2019-03-15 15:09                                                             ` Stefan Monnier
2019-03-15 15:56                                                               ` Eli Zaretskii
2019-03-15 13:54                                                         ` Eli Zaretskii
2019-03-15 14:19                                                           ` Alp Aker
2019-03-15 14:58                                                             ` Clément Pit-Claudel
2019-03-16 15:07                                                               ` Johan Bockgård
2019-03-16 15:22                                                                 ` Clément Pit-Claudel
2019-03-15 15:43                                                             ` Eli Zaretskii
2019-03-15 17:24                                                               ` Óscar Fuentes
2019-03-15 18:28                                                                 ` Clément Pit-Claudel
2019-03-15 14:35                                                           ` Alp Aker
2019-03-09 18:02                             ` John Yates
2019-03-09 18:23                               ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2019-03-15 16:59 Drew Adams
2019-03-15 18:21 ` Eli Zaretskii
2019-03-15 19:18   ` Drew Adams
2019-03-15 19:30     ` Eli Zaretskii
2019-03-15 19:51 ` Ergus
2019-03-18  1:03 Ergus
2019-03-18  3:35 ` Eli Zaretskii
2019-03-18 11:42   ` Ergus
2019-03-18 17:10     ` Eli Zaretskii
2019-04-02 12:42       ` Ergus
2019-04-02 13:03         ` Óscar Fuentes
2019-04-02 13:25           ` Óscar Fuentes
2019-04-02 13:37           ` Ergus
2019-04-02 15:07             ` Eli Zaretskii
2019-04-02 15:35               ` Ergus
2019-04-02 15:44                 ` Eli Zaretskii
2019-04-02 16:36                   ` Ergus
2019-04-02 16:48                     ` Eli Zaretskii
2019-04-02 17:00                       ` Ergus
2019-04-02 17:26                         ` Eli Zaretskii
2019-04-02 17:48                           ` Ergus
2019-04-02 18:28                             ` Eli Zaretskii
2019-04-02 21:22                               ` Ergus
2019-04-03  5:20                                 ` Eli Zaretskii
2019-04-03 10:22                                   ` Ergus
2019-04-03 11:11                                     ` Eli Zaretskii
2019-04-05  9:10                                       ` Robert Pluim
2019-04-05 10:36                                         ` Ergus
2019-04-05 11:47                                           ` Eli Zaretskii
2019-04-05 12:13                                             ` Robert Pluim
2019-04-05 12:46                                               ` Eli Zaretskii
2019-04-05 14:09                                                 ` Robert Pluim
2019-04-05 14:13                                                   ` Eli Zaretskii
2019-04-05 14:38                                                     ` Eli Zaretskii
2019-04-05 15:04                                             ` Ergus
2019-04-05 15:17                                               ` Eli Zaretskii
2019-04-05 17:30                                                 ` Ergus
2019-04-05 19:05                                                   ` Eli Zaretskii
2019-04-05 20:03                                                     ` Ergus
2019-04-05 21:10                                                       ` Óscar Fuentes
2019-04-05 22:01                                                         ` Ergus
2019-04-05 22:20                                                           ` Óscar Fuentes
2019-04-06  6:49                                                         ` Eli Zaretskii
2019-04-06 11:06                                                           ` Ergus
2019-04-06 12:53                                                             ` Eli Zaretskii
2019-04-06  6:51                                                       ` Eli Zaretskii
2019-04-06 13:21                                                         ` Eli Zaretskii
2019-04-06 15:20                                                           ` Ergus
2019-04-06 16:00                                                             ` Eli Zaretskii
2019-04-06 18:59                                                               ` Ergus
2019-04-06 19:07                                                                 ` Eli Zaretskii
2019-04-06 19:51                                                                   ` Ergus
2019-04-07 18:19                                                                   ` Ergus
2019-04-07 18:31                                                                     ` Eli Zaretskii
2019-04-07 18:35                                                                       ` Ergus
2019-04-07 18:38                                                                       ` Ergus
2019-04-07 19:02                                                                         ` Eli Zaretskii
2019-04-07 20:05                                                                           ` Ergus
2019-04-08  2:27                                                                             ` Eli Zaretskii
2019-04-08  8:51                                                                               ` Ergus
2019-04-08 14:57                                                                                 ` Eli Zaretskii
2019-04-08 16:04                                                                                   ` Ergus
2019-04-12 13:46                                                                                   ` Ergus
2019-04-12 13:54                                                                                     ` Eli Zaretskii
2019-05-01 11:08                                                                                       ` Ergus
2019-05-03 13:19                                                                                         ` Eli Zaretskii
2019-05-03 14:14                                                                                           ` Basil L. Contovounesios
2019-05-03 15:10                                                                                             ` Eli Zaretskii
2019-05-03 15:25                                                                                               ` Basil L. Contovounesios
2019-05-03 16:21                                                                                                 ` Eli Zaretskii
2019-05-03 16:18                                                                                             ` Ergus
2019-05-03 17:49                                                                                           ` Ergus
2019-05-03 18:32                                                                                             ` Eli Zaretskii
2019-05-03 18:39                                                                                             ` Eli Zaretskii
2019-05-03 21:05                                                                                               ` Ergus
2019-05-04  6:54                                                                                                 ` Eli Zaretskii
2019-05-04  9:37                                                                                                   ` Ergus
2019-05-04 11:04                                                                                                     ` Eli Zaretskii
2019-05-04 11:29                                                                                                       ` Óscar Fuentes
2019-05-04 15:44                                                                                                         ` Alp Aker
2019-05-04 15:59                                                                                                           ` Eli Zaretskii
2019-05-04 16:32                                                                                                             ` Eli Zaretskii
2019-05-04 16:32                                                                                                             ` Alp Aker
2019-05-04 16:36                                                                                                               ` Eli Zaretskii
2019-05-04 16:38                                                                                                                 ` Alp Aker
2019-05-04 16:42                                                                                                                   ` Eli Zaretskii
2019-05-05 14:40                                                                                                                     ` Ergus
2019-05-04 16:42                                                                                                             ` Ergus
2019-05-03 14:34                                                                                         ` Basil L. Contovounesios
2019-05-03 15:31                                                                                         ` Alp Aker
2019-04-07 20:51                                                                           ` Ergus
2019-04-07 21:23                                                                             ` Stefan Monnier
2019-04-07 21:37                                                                               ` Ergus
2019-04-07 21:39                                                                                 ` Stefan Monnier
2019-04-05 13:06                                           ` Eli Zaretskii
2019-04-05 15:28                                             ` Eli Zaretskii
2019-04-05 18:11                                               ` Ergus
2019-04-05 19:03                                                 ` Eli Zaretskii
2019-04-05 21:15                                                   ` Ergus
2019-04-06 10:13                                                     ` Robert Pluim
2019-04-06 12:54                                                       ` Eli Zaretskii
2019-04-05 11:44                                         ` Eli Zaretskii
2019-04-05 12:09                                           ` Robert Pluim
2019-04-05 12:44                                             ` Eli Zaretskii
2019-04-05 13:21                                               ` Eli Zaretskii
2019-04-05 13:47                                                 ` Robert Pluim
2019-04-05 14:08                                               ` Robert Pluim
2019-04-03 12:13                                     ` Stefan Monnier
2019-04-02 23:11                       ` Dmitry Gutov
2019-04-02 17:01                     ` Robert Pluim
2019-04-02 17:26                       ` Ergus
2019-04-02 17:50                         ` Robert Pluim
2019-05-04 22:51 Keith David Bershatsky

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=23c888a1-66ba-5f98-cd32-567457af84d8@gmail.com \
    --to=alp.tekin.aker@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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.