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#45837: 28.0.50; incorrect cursor position in visual-line-mode when word-wrap-by-category is t Date: Fri, 15 Jan 2021 10:15:08 +0200 Message-ID: <834kjiboqb.fsf@gnu.org> References: <838s8wdhbf.fsf@gnu.org> <83v9bzbp8s.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22845"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45837@debbugs.gnu.org To: Liu Hui Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 15 09:16:25 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 1l0KHR-0005pR-3K for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Jan 2021 09:16:25 +0100 Original-Received: from localhost ([::1]:52486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0KHP-000070-O4 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 15 Jan 2021 03:16:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0KH4-00006t-19 for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 03:16:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0KH3-0007T3-Pf for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 03:16:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l0KH3-0006FM-JM for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 03:16:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Jan 2021 08:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45837 X-GNU-PR-Package: emacs Original-Received: via spool by 45837-submit@debbugs.gnu.org id=B45837.161069852923966 (code B ref 45837); Fri, 15 Jan 2021 08:16:01 +0000 Original-Received: (at 45837) by debbugs.gnu.org; 15 Jan 2021 08:15:29 +0000 Original-Received: from localhost ([127.0.0.1]:39845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0KGX-0006EU-EO for submit@debbugs.gnu.org; Fri, 15 Jan 2021 03:15:29 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38984) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0KGU-0006EH-Vs for 45837@debbugs.gnu.org; Fri, 15 Jan 2021 03:15:27 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40892) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0KGP-00075X-R8; Fri, 15 Jan 2021 03:15:21 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1516 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l0KGF-0006os-KA; Fri, 15 Jan 2021 03:15:21 -0500 In-Reply-To: (message from Liu Hui on Fri, 15 Jan 2021 15:28:33 +0800) 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:197975 Archived-At: > From: Liu Hui > Date: Fri, 15 Jan 2021 15:28:33 +0800 > Cc: 45837@debbugs.gnu.org > > I have tested the patch and found that the condition `(= (cdr (nth 2 > (posn-at-point))) orig-y)` was sometimes too strict. `posn-at-point` > may give slightly different y positions for characters on the same > line when different fonts were used (examples can be found in the > HELLO file). If there are inline graphics (e.g. latex previews), the y > position can also be different. Hmm... you are right. But that sounds like a bug in posn-at-point, I will look into fixing it soon. > My suggestion is `(< (abs (- (cdr (nth 2 (posn-at-point))) orig-y)) > X)`, where X could be, empirically, `(/ (line-pixel-height) 3)` or > a customizable value. I went with half the line height, thanks. > The patch works well in other cases, thanks! Thanks for testing, I've now installed the change on the master branch. I'm not yet closing the bug, because I want to see what can be done about removing the tolerance in comparing values of posn-at-point.