[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fill column indicator functionality

From: Ergus
Subject: Re: Fill column indicator functionality
Date: Tue, 12 Mar 2019 16:29:30 +0100
User-agent: NeoMutt/20180716

Hi Eli:

Sorry for being so annoying. But this is my first contribution and I am
still understanding the details on the way.

On Mon, Mar 11, 2019 at 05:30:47PM +0200, Eli Zaretskii wrote:

I think you are missing this:

     /* If last glyph is a space or stretch, and it's trailing
         whitespace, set the face of all trailing whitespace glyphs in
         IT->glyph_row to `trailing-whitespace'.  */
     if ((row->reversed_p ? glyph <= start : glyph >= start)
          && BUFFERP (glyph->object)  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
          && (glyph->type == STRETCH_GLYPH
              || (glyph->type == CHAR_GLYPH
                  && glyph->u.ch == ' '))
          && trailing_whitespace_p (glyph->charpos))

This test is for those stretch glyphs that came from a buffer,
i.e. those generated by TABs and 'space' display properties.  But in
your case, the object of the stretch glyph is nil, as specified by the
2nd argument of append_stretch_glyph:

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

Moreover, I believe you are looking at the wrong code fragment to
explain why trailing-whitespace stopped working.  I think the problem
happens a bit earlier, here:

     /* Skip over glyphs inserted to display the cursor at the
         end of a line, for extending the face of the last glyph
         to the end of the line on terminals, and for truncation
         and continuation glyphs.  */
     if (!row->reversed_p)
          while (glyph >= start
                 && glyph->type == CHAR_GLYPH
                 && NILP (glyph->object))

I tried:
   if (!row->reversed_p)
          while (glyph >= start
                 && (glyph->type == CHAR_GLYPH
                     || glyph->type == STRETCH_GLYPH)
                 && NILP (glyph->object))

But it didn't work. The behavior is the same: the whitespace is
highlighted only when the line is crossed.

The other corner case I have is because in graphical mode the space for
the dot is always reserved, so when the last character in the line is
just before the line, the line is not drawn for that line.

I can live with that, but maybe there is a simple fix?

In text mode I fixed this changing a while for a do while, but in
graphical mode the approach is different.

2) What name do you suggest for this mode? I propose



Thanks again for working on this.

P.S. Thanks to you, I just uncovered an old bug, whereby
show-trailing-whitespace didn't work in R2L screen lines, and for the
same reason: the code didn't account for the stretch glyphs inserted
by the display engine at the left edge of such lines.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]