From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Radon Rosborough Newsgroups: gmane.emacs.bugs Subject: bug#48170: next-line on large lines or images skips unexpectedly to next logical line Date: Sun, 2 May 2021 13:41:54 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38965"; mail-complaints-to="usenet@ciao.gmane.io" To: 48170@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 02 22:43:35 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ldIwA-000A3x-SE for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 22:43:35 +0200 Original-Received: from localhost ([::1]:58790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldIw7-0008Uy-Ev for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 May 2021 16:43:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldIvf-0008RP-MB for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 16:43:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33077) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldIvf-0006TQ-DZ for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 16:43:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ldIvf-0000aQ-9L for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 16:43:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Radon Rosborough Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 May 2021 20:43:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48170 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16199881592225 (code B ref -1); Sun, 02 May 2021 20:43:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 May 2021 20:42:39 +0000 Original-Received: from localhost ([127.0.0.1]:44620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldIvH-0000Zp-7k for submit@debbugs.gnu.org; Sun, 02 May 2021 16:42:39 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:59686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldIvC-0000Zj-Jx for submit@debbugs.gnu.org; Sun, 02 May 2021 16:42:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldIvC-0008Ce-CO for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 16:42:34 -0400 Original-Received: from mail-vk1-xa2a.google.com ([2607:f8b0:4864:20::a2a]:39493) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldIvA-0006C4-Gx for bug-gnu-emacs@gnu.org; Sun, 02 May 2021 16:42:34 -0400 Original-Received: by mail-vk1-xa2a.google.com with SMTP id n74so842017vkc.6 for ; Sun, 02 May 2021 13:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=lN47883geswu4IPX+xwnpQpkQTzwqLGweoVFdE9/Z4o=; b=RUWQw7zElf5JJ5cAXD62h5EBonM9GpUP9MkrPv/nBn4Ygfs8yBoUgIjpfFYDih0Gwz +sPO/2o2vxCbnIsNetBNsedsuDPyYLpWt+F80KpG0GoFqPt5Y3/pfNg1aQf1CbgUUZeT uavv7s0f6Ki7sKkjGZFLxNNwuAVOoVHtqrjxG8uYoI+rp6RqEpwHefZpzM9ylBezHZwz 0BKvUbPx0y3kpODT86SGCZacygbXPhjQA9EtwEmyC9bbvrmx9sqh+0+g8fXDVRc84art fCTn5WOdqLybJT5F3GLczKy8G5DlbzonIvCUtMlqG7YE2gtkx49rUvskSkzIVyUifHIs m52w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=lN47883geswu4IPX+xwnpQpkQTzwqLGweoVFdE9/Z4o=; b=iIQeGn3pJ0Joma36QUdq91zOINmxVmDbfZORN/OYMnY0T43QjOkEGy9pMQz9tu/5k5 06/1J/gZLhSFc8TUPZU/JJCo+t/rD1gEoCe6uwNTHxLmFm7r6y74EvqQFPB5SdFW2ufi Xg7eHKRzGHAKByoun6XJgXWcCM0GVGMzaD3Xdzq0EcFTvA35y9AEWAIiAK05pxfunvFS SQJLYfQ4x10pi614BEbIBv/NB6lZZkwndTzRIYU9KXXBEuP/VxWfYpbY6Qk3t4iCQbkj hEcZRnBuktrCU8Ves2xwjEz4pknDVsNn/l8PZWm/NA09UZEOhDWG6HUDh2wU6vMWpvaI 2hZg== X-Gm-Message-State: AOAM530K6PeaoXZLnckP2KFkAc+eR/qFTgGB10KNb8JTVSBNGE4bt5kn ugaQrMgG0AMenOuZfqFY2Z6lGJ6Ho3lKXNOp2DRmfpCsESdTWg== X-Google-Smtp-Source: ABdhPJwTzApqmsivp97EhMuX0+HMJhCJkEO15huVdg2NmaEtURJSq2rPbFIp4Euq7CO5BEs5vjxjrX2NBtx5y4khTcY= X-Received: by 2002:a1f:d283:: with SMTP id j125mr12667285vkg.9.1619988150588; Sun, 02 May 2021 13:42:30 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::a2a; envelope-from=radon.neon@gmail.com; helo=mail-vk1-xa2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205447 Archived-At: Hi all, I believe I've identified a bug in the implementation of `line-move-partial' which occurs with certain pixelwise vertical scroll positions. The bug is that (under certain circumstances) when using `next-line' on a long, visually-wrapped line, instead of moving to the next visual line, point moves to the next logical line. The "certain circumstances" are as follows: 1. Point is within a long logical line that is visually wrapped onto at least two visual lines (the visual line containing point, and at least one subsequent visual line). 2. The window line containing point is the bottom-most window line that is fully visible. 3. The next window line is partially visible, and the pixel height of the visible part of that line is less than the default line height (as returned by `default-line-height'). This bug can be reproduced in either release 27.2 or the latest development branch (83a915d3dfafd5f3d737afe1e13b75e4dd3aef96 of 2021-04-25). It does not require any configuration or third-party packages (emacs -Q). Because the default line height is fairly small (36px), it is difficult to set up the pixelwise vertical scroll position appropriately to trigger the bug, at least by default. Applying a face with an increased :height property and increasing the text scaling makes it easier, but I have confirmed that the bug reproduces even with the default font face, given precise enough positioning. I have uploaded a video demonstrating the behavior in the latest development version of Emacs: https://youtu.be/dYMjgLSbGNE I did some debugging in the course of identifying the conditions to reproduce the bug, and the problematic behavior seems to come down to something in the implementation of `line-move-partial'. There's a conditional check (<= this-ypos (- dlh)) in `line-move-partial' that gets triggered for certain combinations of window sizes and font heights, and the code gated behind this check appears to be buggy, resulting in the observed behavior. I would be happy to get input about whether others can reproduce this bug, and/or if you have ideas about the most appropriate way to fix or work around it. In case you're wondering how I ran into this issue: I am developing a music player for Emacs which displays albums in a grid view for selection, like iTunes. The implementation is to insert images via `make-image', all in a single logical line, with appropriate margin properties, and then let Emacs take care of the line-wrapping to form a grid. Unfortunately, images are essentially very tall lines, which makes it extremely easy to trigger this bug. The result is that when you use `next-line' at the bottom of the window, point gets moved all the way to the end of the buffer, which is no good. In case it's relevant, I'm running GNOME under Pop!_OS. Best, Radon Rosborough https://github.com/raxod502