unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: `window-absolute-pixel-position' with vscroll
@ 2023-06-21 20:42 Rahguzar
  2023-06-22 16:59 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Rahguzar @ 2023-06-21 20:42 UTC (permalink / raw)
  To: eliz; +Cc: help-gnu-emacs

Hi Eli,

Due to some reason I didn't receive your message and only saw it
because I checked archives just now.

Consider the following code,

(progn
  (goto-char (point-max))
  (insert "\n")
  (insert-image (create-image "path/to/image"))
  (insert "\n")
  (insert-image (create-image "path/to/image")))

I pasted it in scratch buffer starting from `emacs -Q` and then
evaluated it.

Now go to the first image and use `i +` till the image height is larger
than the window height (more about needing this below).

Then do `M-: (set-window-vscroll nil 100 t t)`

Where 100 is just a place holder but the number should be smaller than
the window height and large enough that the second image comes into
view.

Next do `M-: (window-absolute-pixel-position (point))`
I got `(1896 . 0)` which I don't know how to interpret since that is
supposed to represent the top-left corner of the image but that corner
is not visible in window and I don't know how that 1896 came to be there.

Next do `M-: (window-absolute-pixel-position (+ 2 (point)))`

I got `(8 . 862)`, which matches what I expect from evaluating
`(pos-visible-in-window-p (point) nil t)`. Although I remember this
result being confusing too but I think it was just me being confused.

While doing this I noticed that I can't set vscroll until image is
taller than the window i.e. in this case the top of first the image
remains glued to the top of the window. This is not the case with text
i.e. `M-: (progn (goto-char (point-min)) (set-window-vscroll nil 10 t t))`
in the scratch buffer partially hides the top line for me as expected
but if the window starts at an image less tall than the window and I do
`M-: (set-window-vscroll nil 100 t t)` the top of the image remains
visible even if the image is more than 100 pixels tall.

Thanks,
Rahguzar



^ permalink raw reply	[flat|nested] 6+ messages in thread
* `window-absolute-pixel-position' with vscroll
@ 2023-06-20 19:23 Rahguzar
  2023-06-21 12:50 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Rahguzar @ 2023-06-20 19:23 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,
Reading the manual and documentation I understand the
`window-absolute-pixel-position' if there is no vscroll. If however the
value of `(window-vscroll)` is non-nil calling

(window-absolute-pixel-position (window-start))

produces results which I don't know how to interpret since the upper
left corner of the line is not visible. I wanted to know the pixel
position of the start of some subsequent visible line but results of
`(window-absolute-pixel-position pos)' didn't make sense to me. I
eventually managed to do it by using a combination of
`pos-visible-in-window-p' and `line-pixel-height' but maybe there is a
simpler way using `window-absolute-pixel-position'.

Thanks in advance,
Rahguzar



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-06-23 15:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87r0q2dxvz.fsf@zohomail.eu>
     [not found] ` <83fs6i1a64.fsf@gnu.org>
2023-06-23 15:22   ` `window-absolute-pixel-position' with vscroll Rahguzar
2023-06-23 15:47     ` Eli Zaretskii
2023-06-21 20:42 Rahguzar
2023-06-22 16:59 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2023-06-20 19:23 Rahguzar
2023-06-21 12:50 ` Eli Zaretskii

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).