From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73863: 30.0.91; Unexpected cursor movement with flymake-show-diagnostics-at-end-of-line Date: Sun, 20 Oct 2024 10:25:07 +0300 Message-ID: <86a5ezjkx8.fsf@gnu.org> References: <86r08dmm0h.fsf@gnu.org> <86plnxmfdt.fsf@gnu.org> <86y12kjks0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32578"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73863@debbugs.gnu.org To: Romain Ouabdelkader , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 20 09:25:52 2024 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 1t2QJz-0008KD-6l for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 20 Oct 2024 09:25:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t2QJn-0004MK-6J; Sun, 20 Oct 2024 03:25:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2QJl-0004Lx-NI for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2024 03:25:37 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t2QJl-0001UU-ET for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2024 03:25:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-version:References:In-Reply-To:From:Date:To:Subject; bh=hr9yesSQUccdbc732herKgVmUHNhkTYHB46htbYL+Ws=; b=JALD+gXxL5/DOD2tisCz6gItZGob7IwHHVGdlgVL9b9HQj2QT4cD3RjiBUY36M/VsMZph6KiYM+F3xvXPShf6pz7vQOJnh/vrtPAYhdzd83bWBwRmjg5Y4BMLYmPT2+ggQjc+VXj1+bBaLWrHtTZ0hS80R5+ou15ir5qjNOyBtU1YVYsuUzp9/OaFQCGbz1AkVpD5e2KleolRWBnWRk7IVK+cLjTvePSD/OFDYFs1Vd286Zj5sSZq/xR8ap4lbWEd7MYebKyboDlPIsJWvA+DFGSUBlDiQxavnGa06JUKkEvN38j6MqT+kNIwBvQHUOdTsU/nXUw60hEndnRAHGAhQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t2QKA-0007wx-54 for bug-gnu-emacs@gnu.org; Sun, 20 Oct 2024 03:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 20 Oct 2024 07:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73863 X-GNU-PR-Package: emacs Original-Received: via spool by 73863-submit@debbugs.gnu.org id=B73863.172940914630533 (code B ref 73863); Sun, 20 Oct 2024 07:26:02 +0000 Original-Received: (at 73863) by debbugs.gnu.org; 20 Oct 2024 07:25:46 +0000 Original-Received: from localhost ([127.0.0.1]:45602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2QJt-0007wP-KC for submit@debbugs.gnu.org; Sun, 20 Oct 2024 03:25:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2QJr-0007rg-G0 for 73863@debbugs.gnu.org; Sun, 20 Oct 2024 03:25:44 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t2QJL-0001TE-4k; Sun, 20 Oct 2024 03:25:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=hr9yesSQUccdbc732herKgVmUHNhkTYHB46htbYL+Ws=; b=kKq5XkUELQhsYwPNaSfy dm3jhpu4FA2Pl5DCJ1Tr6B8U3ijwn3q9QybGTmhSUq2I1h6POUvoA5wOMG+vdgjxLPsD81BGbJHVd DDG3IFB+jEHkhHgCSfRsLvv6Be8Xb1n+eNIJs87/zLDVK93ZblRyUPCtFI8RYI/kCVAU9pwt+hMV7 e4SOQmFpLbnPl6lViOeKm7y99a62E5fKra8xbSUyzxttFTViJWaLq4C5L7lLeHqVjnj8pRdHZS0IW K7Z7x+KVfk13NK+zvjvyRETw9ca4QYE89Avh/bSubzD3T1sCVfmIkBRWjYAM1V4IhOn6bwHTI4orm MF3Y3f3HupL2Xg==; In-Reply-To: (message from Romain Ouabdelkader on Sat, 19 Oct 2024 15:41:05 +0200) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293932 Archived-At: > From: Romain Ouabdelkader > Date: Sat, 19 Oct 2024 15:41:05 +0200 > Cc: 73863@debbugs.gnu.org > > So this problem only happens when the window is not wide enough, and > the diagnostic wraps to the next screen line? > > Yes that's correct, this happens to me quite often when I have two windows open side by side. This is actually what flymake.el requests the display engine to do: it asks it to show the cursor on the first character of the diagnostic's before-string: (put-text-property 0 1 'cursor t summary) So when you use C-n, Emacs moves point to the end of the before-string, but the 'cursor' property tells it to show the cursor on the first character of the before-string, which is on a previous screen line. So the display engine obeys and shows the cursor there. The following simple patch seems to give much better results. João, is the code in question used by any Flymake feature other than this new flymake-show-diagnostics-at-end-of-line option? If so, we'll probably need some condition to move the 'cursor' property to end of string (assuming you don't object to this solution). diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 9a6b62c..0ef1ed0 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -835,8 +835,12 @@ flymake--eol-overlay-summary (1- (length diags))) 'face 'flymake-eol-information-face))))) (t - (mapconcat #'summarize diags " ")))))) - (put-text-property 0 1 'cursor t summary) + (mapconcat #'summarize diags " "))))) + (last-pos (1- (length summary)))) + ;; Put the 'cursor' property on the last character of the summary, + ;; so that vertical-motion produces the expected results when the + ;; summary wraps to next screen lines. + (put-text-property last-pos (1+ last-pos) 'cursor t summary) summary))) (defun flymake--update-eol-overlays ()