Subject: bug#54800: 28.1; calc: Cursor positioned at weird position in calc stack

From: Eli Zaretskii <[email-masked]>
Date: Mon, 11 Apr 2022 14:45:56 +0300

> Date: Mon, 11 Apr 2022 14:27:35 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > I noticed that while the patch fixes the problem in most cases,
> > depending on the height of the calc stack window, there can be the case
> > that the cursor is not positioned on the top-of-stack symbol `.' but one
> > line
> > above, at the beginning of the line with the first stack entry.
> > 
> > This can be changed by using the number 4 instead of 3 in the patch.
> > Not sure if this is the best fix.
> > 
> > (vertical-motion (- 4 (window-height win)))
> 
> Can you show a reproducible recipe starting from "emacs -Q", so I
> could investigate?

And while at that, would the below fix the problem in the rare cases
where you saw them?

  (vertical-motion (- 3 (window-height win 'ceiling)))

That is, ask window-height to produce the smallest integer number
greater than the window's height (in case the height in line units is
not integer)?