From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Liu Hui 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: Thu, 14 Jan 2021 12:51:12 +0800 Message-ID: References: <838s8wdhbf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27023"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45837@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 14 05:52: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 1kzucS-0006tt-H6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Jan 2021 05:52:24 +0100 Original-Received: from localhost ([::1]:43914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kzucR-0002sk-3D for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Jan 2021 23:52:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kzuc7-0002sH-U1 for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2021 23:52:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kzuc6-0006er-4X for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2021 23:52:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kzuc6-0006bo-2b for bug-gnu-emacs@gnu.org; Wed, 13 Jan 2021 23:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Liu Hui Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Jan 2021 04:52:02 +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.161059989125358 (code B ref 45837); Thu, 14 Jan 2021 04:52:02 +0000 Original-Received: (at 45837) by debbugs.gnu.org; 14 Jan 2021 04:51:31 +0000 Original-Received: from localhost ([127.0.0.1]:36987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzuba-0006aw-Ps for submit@debbugs.gnu.org; Wed, 13 Jan 2021 23:51:31 -0500 Original-Received: from mail-qk1-f181.google.com ([209.85.222.181]:46601) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kzubZ-0006ag-55 for 45837@debbugs.gnu.org; Wed, 13 Jan 2021 23:51:30 -0500 Original-Received: by mail-qk1-f181.google.com with SMTP id d14so5670215qkc.13 for <45837@debbugs.gnu.org>; Wed, 13 Jan 2021 20:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Duso+8r5/60tDrlUlKeodhGDPlJbeW7/ZkP/Lb/Y0u4=; b=b6myKw6ZBqwCdr1uAuM37ShmV5P8ZQmN/+Pi7ZyO7NGRoA+spIVxFIUsorgHc/dWR0 M1ff4lNtzUSn9CWv728He950VNG0zyW0H2sjnv535H3nILlLev9MmVedGPzicI+0ZDhT geK5INED5+F/C7qKEJVHof/gS430pxdvMPZxEa8K69cZLAPUrfNpJ3QecQs4QQGPwj/u NLKrqEns8rWANP1d2o/24dxCEaEyBl0yX9qAH8vrnp49M6gm/nRPCOAn6yvviVVygBqb 1uk6gs4CCDlMXI22Q8/HmezlaUoZYdAAN168dS297nxhLDijZM6607rkZjN8eofwKzBJ 2ZPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Duso+8r5/60tDrlUlKeodhGDPlJbeW7/ZkP/Lb/Y0u4=; b=HL9/kIGpJrOLUS281Ekd/S2/buD5jOmXSPksCr70WaLqHldtNSLOYWYYSJiDTbE33J y8ualRPgtP8vAsEIcV13rSkU9+aoVN8ApBy4Ci5+XgOa/om6VGIQUdkYxmgZCe+9DjoB MKrl9gmhtdudv2TGOvkOCF5NF1wbagBDQk7CkQGcRiaYRtoHnr/oQnRXIM2fI2nuwryz bV/E+4tkJqxZKlaPuxif1PsLahKqHvWzF54QzNwcg7AeWi7xyih19cxnyb2XSAdN7xao eNY5+1tA4jE6vR8IoG96NKFkYW7gflJsUpDA3LElGM+OABOqoGoMFKJusHpOs5l4IVHB 5h4w== X-Gm-Message-State: AOAM530J9kOPd3zZ7EBR9wbpdfZ/GLQIAT2LlUswmPHogusXlDiu/OPD kH+99faxHMwwbJ6oxfWzhKqjPD89bqDDR4TQOeM= X-Google-Smtp-Source: ABdhPJzCcvJcH3hLwj/y0MPGxGo9Ir3MHVYIvhjHfiFPnAkpNXgF2Re91tz1VZRrFnH63Bdak2x4Xuflxbc0+0y5Ar0= X-Received: by 2002:a25:26c7:: with SMTP id m190mr7889830ybm.464.1610599883412; Wed, 13 Jan 2021 20:51:23 -0800 (PST) In-Reply-To: <838s8wdhbf.fsf@gnu.org> 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:197927 Archived-At: Eli Zaretskii =E4=BA=8E2021=E5=B9=B41=E6=9C=8813=E6=97=A5=E5= =91=A8=E4=B8=89 =E4=B8=8B=E5=8D=8810:47=E5=86=99=E9=81=93=EF=BC=9A > > > From: Liu Hui > > Date: Wed, 13 Jan 2021 10:27:24 +0800 > > > > Steps to reproduce: > > 1. emacs -Q > > 2. eval the following code in the *scratch* buffer: > > > > (with-current-buffer-window "*test*" nil nil > > (dotimes (_ 3) > > (dotimes (i 10) > > (insert "=E4=B8=80=E4=BA=8C=E4=B8=89=E5=9B=9B=E4=BA=94=E5=85= =AD=E4=B8=83=E5=85=AB=E4=B9=9D=E5=8D=81")) > > (dotimes (i 20) > > (insert "test "))) > > (setq word-wrap-by-category t) > > (visual-line-mode)) > > > > 3. In the *test* buffer, C-a/C-e don't always move the cursor to the > > beginning/end of screen line. There is also an offset between the mouse > > click location and the cursor position. If there seems to be no problem= , > > you can adjust the window width and recheck the cursor movement. > > Thanks, should be fixed now. Thank you, cursor motion is correct now. BTW, in the case above, if the line wraps after a non-whitespace character, C-k does not delete this character. How about the following change to kill-visual-line? diff --git a/lisp/simple.el b/lisp/simple.el index 54c35c04be..86e2c41ac2 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -7337,6 +7337,9 @@ kill-visual-line (end-of-visual-line 1) (if (=3D (point) opoint) (vertical-motion 1) + (when (and word-wrap-by-category + (elt (char-category-set (following-char)) ?|)) + (forward-char)) ;; Skip any trailing whitespace at the end of the visual line. ;; We used to do this only if `show-trailing-whitespace' is ;; nil, but that's wrong; the correct thing would be to check