[Top][All Lists]

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

Re: line-pixel-height beyond eol

From: Tak Kunihiro
Subject: Re: line-pixel-height beyond eol
Date: Fri, 15 Sep 2017 10:39:53 +0900 (JST)

>>   (progn (vertical-motion 1)
>>          (dolist (vs (number-sequence 1 (1- (save-excursion
>>                                               (goto-char (window-start))
>>                                               (line-pixel-height)))))
>>            (set-window-vscroll nil vs t) (sit-for 0.01))
>>          (scroll-up 1))
>> Let's assume a line with image of height 144 pixel is located on the
>> top line.  When auto-hscroll-mode is off and (current-column) is large
>> (the 144 pixel image is scrolled left), the top line looks 27 pixel
>> height but (line-pixel-height) returns 144 pixel.  The inconsistency
>> results in jump.
> Would it help not to use the height of the top window line, but
> instead simply use the value returned by frame-char-height?  That
> takes its value from the frame's default font, and so should be
> independent on what's in the window.

That is a good idea!  I want to scroll that way.

To scroll pixels by frame-char-height, a line should be flushed by
(scroll-up 1) when (window-vscroll nil t) is very close to height of
pixel on the top window line.

If this flush does not happened on the right timing, screen jumps
unexpectedly as demonstrated below.

M-x about-emacs
M-: (progn
        (dolist (vs (number-sequence 1 (1- (frame-char-height))))
          (set-window-vscroll nil vs t) (sit-for 0.01))
        (scroll-up 1))

Thus I have to know height of pixel on the top window line.

reply via email to

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