Eli Zaretskii <eliz@gnu.org> writes:
— a/src/xdisp.c
+b/src/xdisp.c
@@ -8430,68430,34 @@ getnextdisplayelement (struct it *it)
int lfaceid = 0;
int escapeglyph;
+ if (c= '\f' && it->current_x =
it->firstvisiblex)
IMO, this condition is incorrect. You should test for the previous
character being a newline. The it->firstvisiblex condition will be
wrong in a continuation line, when the window is hscrolled, and when
display-line-numbers-mode is turned on, as well as in some other
situations (line/wrap-prefix etc.).
+ {
+ const int savefaceid = it->faceid;
+ const int savechar = it->chartodisplay;
+ const int savecurrentx = it->currentx;
+ const int saveascent = it->ascent;
+ const int savedescent = it->descent;
+
+ faceid =
+ mergefaces (it->w, Qtrailingwhitespace, 0, it->faceid);
+ XSETINT (it->ctlchars[0], 0);
+ ctllen = 0;
+
+ it->chartodisplay = '-';
+ it->faceid = faceid;
+ for ( ; it->currentx - it->endcharpos <= it->lastvisiblex; it->currentx+)
This condition is also incorrect, IMO: it->currentx is the pixel
coordinate, whereas it->endcharpos is a character position in the
buffer, so you cannot meaningfully subtract them. Also, I think this
will be incorrect when the window has display margins.
The right way to figure out the usable width is to call the function
windowboxwidth or windowboxrightoffset.
These wrong conditions are probably the reasons for at least part of
the problems you see with this patch.
I'll take it into account. Thanks.
+ {
+ PRODUCEGLYPHS (it);
+ }
I think it's not a good idea to call PRODUCEGLYPHS inside
getnextdisplayelement.
I originally wanted to put this in displayline, however,
getnextdisplayelement was overriding the character face so i thought
that adding it to getnextdisplayelement (where ^L is displayed)
would be a better solution.
Alternatively, we could implement this entirely in the
terminal-specific back-end of the display engine (xterm.c, w32term.c,
etc.), where we could detect the "L" glyph sequence and replace it
with a horizontal line of a suitable width and thickness. That would
allow us to produce a separator that is much better-looking than just
showing a long line of dashes.
The dashes are temporal, I'm planning to add a variable that store
the character to display (like display-fill-column-indicator-character).
I don't think it would be better display a line instead a character, in
that case, I would have preferred to use a face with a strike-through.
This should work for both Terminal and GUI frames.
In any case, this must be an optional feature, so we will need a user
option to control it, by default off.
Yeah, this will be buffer-local and have an user option (not minor mode)
for enable/disable it (disabled by default), i didn't added the options
yet because first i was testing if this works well, the same for the
face used.