Subject: bug#14324: 24.3; GTK scrollbar doesn't scroll proportionally when Line Wrapping is set to "Truncate Long Lines"

From: Stefan Monnier <[email-masked]>
Date: Thu, 09 May 2013 15:33:20 -0400

>   1. Visit a buffer with very long lines, and long enough to make
>   Emacs render a vertical scrollbar.
>   2. In the Options menu, set the option "Line Wrapping" to "Truncate
>   Long Lines".
>   3. Drag the scrollbar to navigate the file.  Emacs won't scroll
>   proportionally, but rather get stuck at some points, seemingly at
>   those very long lines, maybe as if they were still shown in multiple
>   lines, even though now they don't.

Indeed.  The scrollbar's thumb is placed based on character positions in
the buffer, which is used as an approximation for the "pixel position"
on the rendering of the buffer.

There are various circumstances where this approximation is poor,
basically when some part of the buffer has a visual size that is
disconnected from its character size, e.g. when you use something like
outline-minor-mode, or when you have (large) images in the buffer, or
when (very long) lines are truncated.

I don't see any easy way to fix it.  I fear fixing it would require
a complete redesign of the rendering engine.

We could probably "fix" your case by adding a line-cache, such that
the scrollbar thumb's position can be computed based on line positions
rather than char positions when lines are truncated.  Patch welcome.

        Stefan