From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Scrolling jumpy when line-spacing > 0 Date: Sat, 22 Apr 2017 00:58:08 +0700 Message-ID: References: <83inlxako6.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1492810214 26437 195.159.176.226 (21 Apr 2017 21:30:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 21 Apr 2017 21:30:14 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 21 23:30:11 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1g81-0006mE-OF for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Apr 2017 23:30:10 +0200 Original-Received: from localhost ([::1]:33255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1g87-0006Gd-LP for geh-help-gnu-emacs@m.gmane.org; Fri, 21 Apr 2017 17:30:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d1cpF-0002R1-8y for help-gnu-emacs@gnu.org; Fri, 21 Apr 2017 13:58:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d1cpE-0005Kt-CG for help-gnu-emacs@gnu.org; Fri, 21 Apr 2017 13:58:33 -0400 Original-Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:35373) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d1cpC-0005KQ-T6; Fri, 21 Apr 2017 13:58:31 -0400 Original-Received: by mail-wm0-x22f.google.com with SMTP id w64so21456722wma.0; Fri, 21 Apr 2017 10:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=kyErpoDcBu5jJVDvLO1ZVwP/kRtasDcDa954Ou/4/o8=; b=HiWsk+7qLhOGlqQ6Eq6hhb3Ao6XUrRXTCyrjGg+lZDOQbKS5wGTRYgD8e2+xMCs3U2 z/OI3R9Df54KMq/8ZjRww7vXh4ztLVoTc2YsIOde9KLWLKJPyuJjg+67J3HOiAMa1pDU 16SKfqfyO/pTLTUpjOZYAWonC3QXXikjuCu9lih3rk4W9P7xU/YurxB34pM/+8c6DaWG hmPu1FYFIKH3RTqWlmYZyagjlgZYTJwbTOJHspQ/c/ID7bvP8BW6vpgxcJkHEjXGL47b 6tfS3T7X2vvn8Sk+2TsxONaMDegoC2rRtFaCA651gUEs5VDhl8AA0gxO0hcyRfuIisLR YTzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=kyErpoDcBu5jJVDvLO1ZVwP/kRtasDcDa954Ou/4/o8=; b=cMqbeLjHdijEKTrOfrxOwZEuAY5633GlX1+3s2uxzl/TylknhQGiSu6uQ+dH/0PvNI Patin3gbB30cKVp44VkhEGOhq6mEA0u7+5k4uQutdoRB/JAwCHaPKDpP3mwyW7yK2kFF ljfzTwA5YpnkQOy0mzrXhTPUZ2ocg3ZGArt3T7k5PVRM/mxk3GSC2OLm/kSE8DYrBoP/ 496AzxJA1QnVEaoVdubz9DwdO+LAfbsskw1N0DGV8iZZmPniN0whf9FPkmAURqKWjslp CxZ+4Jax4QEXMoEvkSJ6eQ40gzyRu5UVA+hiskCoHzlgr8q/FwhymIEjO6zB68VkzVC5 AnvA== X-Gm-Message-State: AN3rC/5CGodQN0O+PcU21JOpYOIfU8hUkhaPB94nb6ZAqbpXfRgLG2mt 6zWdPqteIj9c57oWIx3TLBdpolfUtHul X-Received: by 10.28.236.210 with SMTP id h79mr8753726wmi.92.1492797509414; Fri, 21 Apr 2017 10:58:29 -0700 (PDT) Original-Received: by 10.223.169.12 with HTTP; Fri, 21 Apr 2017 10:58:08 -0700 (PDT) In-Reply-To: <83inlxako6.fsf@gnu.org> X-Google-Sender-Auth: 7fbo1VYVKo38tvL4XoPjh5HOJv0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22f X-Mailman-Approved-At: Fri, 21 Apr 2017 17:29:42 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112849 Archived-At: On Fri, Apr 21, 2017 at 9:40 PM, Eli Zaretskii wrote: > (Why do people report bugs here, rather than with report-emacs-bug?) To check if that is indeed a bug worth reporting, or if it is already known, or even already fixed? > On the master branch, when you click on the bottom line of > the window, which is only partially visible in the above scenario, > Emacs scrolls the window half-window up. To be able to put point on > the bottom line, you will need to set window-resize-pixelwise non-nil, > and drag the mode line down pixel by pixel until Emacs lets you put > point there. Which point is that? When the whole additional spacing is visible? As a user, I=E2=80=99d expect that additional spacing does not count toward whether the line is considered visible. > Once this happens, "M-: (scroll-up 1) RET" produces the > effect you expected. Thank you. > Doesn't pos-visible-in-window-p allow you to compute this more > elegantly, without moving point at all? I was in the middle of a $DAYJOB task, and reached for the quickest fix. But no, not really. On the contrary, I am compelled to add more kludges^W idiosyncratic code. There are two special cases. One when the point is initially in the bottommost visible line whose additional spacing is outside view; in this case, (scroll-up 1) would cause the jump. This can indeed be detected with (pos-visible-in-window-p) returning nil. The other special case is when the point is in the topmost visible line. In this case, (scroll-up 1) is forced to move the point into view. The point is moved to the beginning of the new topmost visible line, even if it was in the middle of the line initially. Here I want behavior equivalent to (next-line) followed by (scroll-up), i.e. to keep column position. I see no practical way to detect this condition without moving point. The easiest that comes to mind is to check if the position one visual line up from point is outside view. Factoring out all relevant special case detection, I end up with this: (defun yk-scroll--in-bottommost-line () (not (pos-visible-in-window-p))) (defun yk-scroll--in-topmost-line () (save-excursion (let ((line-move-visual t)) (previous-line)) (not (pos-visible-in-window-p)))) (defun yk-scroll-up () (interactive) (cond ((yk-scroll--in-bottommost-line) (save-excursion (previous-line) (scroll-up 1))) ((yk-scroll--in-topmost-line) (let ((line-move-visual t)) (next-line)) (scroll-up 1)) (t (scroll-up 1)))) (defun yk-scroll-down () (interactive) (cond ((yk-scroll--in-bottommost-line) (previous-line) (scroll-down 1)) (t (scroll-down 1))))