unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Scrolling jumpy when line-spacing > 0
Date: Fri, 21 Apr 2017 18:03:43 +0700	[thread overview]
Message-ID: <CAP_d_8WYUFgpSvMgJHBjyhrYy8j5Meo2p0x2FoHqWMmpHNmAJg@mail.gmail.com> (raw)
In-Reply-To: <CAP_d_8WAzyGbYTQwqPsQMv1+WZT4S33vHfqh4GjwE=tKJXd6Vw@mail.gmail.com>

On Fri, Apr 21, 2017 at 5:13 PM, Yuri Khan <yuri.v.khan@gmail.com> wrote:

> M-: (scroll-up 1)
>
> Observed behavior: Point is on the same line and the line is at the
> top of window.
>
> Expected behavior: Point is on the same line and the line is second
> from the bottom of window. The next line, “and NEWS.1-17 for changes
> in older Emacs versions.”, is visible.

OK, here’s what I came up with, as a kludge.

(defun yk-scroll-up-line ()
  (interactive)
  (let ((last-line-start
         (save-excursion
           (goto-char (window-end))
           (forward-line -1)
           (point)))
        (orig-point (point)))
    ;; If in the bottommost visible line, move to a safe place (line up).
    (when (<= last-line-start orig-point)
      (previous-line))
    (scroll-up 1)
    ;; If we were in the topmost line,
    ;; the original point is now outside the view,
    ;; and the point is now on the new topmost line. Leave it there.
    ;; Otherwise, the original point is still visible. Restore it.
    (when (pos-visible-in-window-p orig-point)
      (goto-char orig-point))))



  reply	other threads:[~2017-04-21 11:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21 10:13 Scrolling jumpy when line-spacing > 0 Yuri Khan
2017-04-21 11:03 ` Yuri Khan [this message]
2017-04-21 14:44   ` Eli Zaretskii
2017-04-21 14:40 ` Eli Zaretskii
2017-04-21 17:58   ` Yuri Khan
2017-04-21 18:56     ` Eli Zaretskii
2017-04-21 19:30       ` Yuri Khan
2017-04-22  7:38         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8WYUFgpSvMgJHBjyhrYy8j5Meo2p0x2FoHqWMmpHNmAJg@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).