[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: Mon, 16 Oct 2017 14:13:03 +0900 (JST)

Thank you for the response.

>>   M-x about-emacs
>>   M-<, C-e, C-b
>>   (posn-at-point) => (#<window 55 on *About GNU Emacs*> 2 (152 . 0) 0 nil 2 
>> (1 . 0) (image :type png :file "splash.png") (0 . 0) (333 . 233))
>>   (set-window-hscroll nil 28)
>>   (posn-at-point) => nil
>> This case, I want to estimate height of a line as height of the image
>> thus frame-char-height does not work.
> You can go to end of line and call posn-at-point there, no?  Here's a
> snippet that works in your case:
>   M-: (global-set-key [f5] (lambda () (interactive) (save-excursion 
> (end-of-line) (message "%s" (posn-at-point))))) RET
> Then press F5, and you will see what you need, no?

Yes, however, it is not guaranteed if end-of-line is always shown on a
screen.  I have to know a char that is shown on the screen in advance.
I think I can find it by (pos-visible-in-window-p xxx nil t).

When a char is shown in the screen, I can get height by
(line-pixel-height).  When no char is shown, I can assume height as

Now I see height of the top line remains tall even an image is off.

 emacs 26.0.90
 emacs -Q
 M-x eww www.gnu.org
 C-n x 16 (to move to GNU picture)
 M-: (set-window-hscroll nil 100)
 M-: (line-pixel-height) ; => 144 (but visually nominal)
 C-l C-l (locate line of GNU picture to the top of the screen)
 M-: (line-pixel-height) ; => 144 (visually tall)

Is this expected behavior?

reply via email to

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