From: Eli Zaretskii <eliz@gnu.org>
To: npostavs@users.sourceforge.net
Cc: 24633@debbugs.gnu.org
Subject: bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop
Date: Sat, 08 Oct 2016 22:57:53 +0300 [thread overview]
Message-ID: <83y41yfwam.fsf@gnu.org> (raw)
In-Reply-To: <87y41yved9.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net)
> From: npostavs@users.sourceforge.net
> Cc: 24633@debbugs.gnu.org
> Date: Sat, 08 Oct 2016 15:18:26 -0400
>
> > Automatic hscrolling is based on length of point's line at the end of
> > redisplaying a window. Here, "line length" means the horizontal space
> > required for displaying all the glyphs of the line, which includes the
> > glyphs that come from the after-string. Since you extend your
> > after-string each time the window is hscrolled, you in effect enlarge
> > the line each time the display engine hscrolls the window, which
> > causes an endless loop.
> >
> > Can you restrict the after-string's length so it always ends at the
> > last character of the line, or some fixed number of columns afterward?
>
> Then it won't reach the edge of the screen when the buffer is scrolled.
Yes, but is it so bad?
> I guess what I would expect is that the automatic hscrolling only goes
> as far as the cursor is rendered, which should be the end of text where
> I put the `cursor' property.
The implementation doesn't actually use the cursor position (it can't:
by the time hscroll_windows runs the cursor is not yet in its final
horizontal position, only its vertical position is correct, because
the horizontal scrolling was not yet done). The implementation uses a
function that simulates redisplay, and that one doesn't pay attention
to the 'cursor' property. So it stops only when the after-string is
exhausted.
> If you think this would be too complex/slow to implement, we can
> mark this bug as wontfix.
It'd be messy, yes. We'd need to search for before- and after-strings
that begin/end right at point, then augment the call to the display
emulating function accordingly, deal with complications like strings
that include newlines, etc.
> >> > In particular, I don't
> >> > understand the align-to expression: e.g., window-hscroll returns its
> >> > value in columns, while align-to needs pixels, AFAIU.
> >>
> >> According to `(elisp) Pixel Specification',
> >>
> >> The form NUM specifies a fraction of the default frame font height
> >> or width. The form `(NUM)' specifies an absolute number of pixels.
> >
> > I admire your courage in reading that documentation and then writing
> > stuff like the above, which the documentation doesn't mention even
> > remotely.
>
> Uh, not sure how to read this, is it irony?
Only a little. I find this area severely under-documented.
next prev parent reply other threads:[~2016-10-08 19:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 1:01 bug#24633: highlight-region func using (window-hscroll) in :align-to spec can cause inf loop npostavs
2016-10-08 11:15 ` Eli Zaretskii
2016-10-08 17:17 ` npostavs
2016-10-08 18:01 ` Eli Zaretskii
2016-10-08 19:18 ` npostavs
2016-10-08 19:57 ` Eli Zaretskii [this message]
2016-10-09 12:29 ` npostavs
2016-10-09 12:42 ` Eli Zaretskii
2016-10-22 19:27 ` npostavs
2016-10-22 19:41 ` Eli Zaretskii
2016-10-22 20:43 ` npostavs
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=83y41yfwam.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=24633@debbugs.gnu.org \
--cc=npostavs@users.sourceforge.net \
/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).