unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Liu Hui <liuhui1610@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 45837@debbugs.gnu.org
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	[thread overview]
Message-ID: <CAOQTW-PgkF5P-TeFeXtY27wwsrefgg42Es0Nj6FSKGYYjYR7bQ@mail.gmail.com> (raw)
In-Reply-To: <838s8wdhbf.fsf@gnu.org>

Eli Zaretskii <eliz@gnu.org> 于2021年1月13日周三 下午10:47写道:
>
> > From: Liu Hui <liuhui1610@gmail.com>
> > 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 "一二三四五六七八九十"))
> >         (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 (= (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





  reply	other threads:[~2021-01-14  4:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13  2:27 bug#45837: 28.0.50; incorrect cursor position in visual-line-mode when word-wrap-by-category is t Liu Hui
2021-01-13 14:47 ` Eli Zaretskii
2021-01-14  4:51   ` Liu Hui [this message]
2021-01-14 13:51     ` Eli Zaretskii
2021-01-15  7:28       ` Liu Hui
2021-01-15  8:15         ` Eli Zaretskii
2021-01-18 17:14           ` Eli Zaretskii
2021-01-21  3:07             ` Liu Hui
2021-01-21 14:22               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQTW-PgkF5P-TeFeXtY27wwsrefgg42Es0Nj6FSKGYYjYR7bQ@mail.gmail.com \
    --to=liuhui1610@gmail.com \
    --cc=45837@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).