1. Frank Fischer
  2. evil
  3. Issues
Issue #119 resolved

next-visual-line jumps to another column when it shouldn't

Titus von der Malsburg
created an issue

Sample text: {{{ test test test }}}

Start Evil with {{{make emacs}}} and bind the following keys: {{{ (define-key evil-normal-state-map (kbd "<down>") 'evil-next-visual-line) (define-key evil-motion-state-map (kbd "<down>") 'evil-next-visual-line) (define-key evil-normal-state-map (kbd "<up>") 'evil-previous-visual-line) (define-key evil-motion-state-map (kbd "<up>") 'evil-previous-visual-line) }}} Then move the cursor to //s// in the last line and press {{{<up>}}}. This should move the cursor to the //s// in the second line. Instead it is moved to the //e//. I think this happens only when the last movement before the {{{<up>}}} was horizontal or when the cursor has been placed with the mouse but not when the last movement was vertical. Similar problem with cursor movements in visual mode.

Tested with the latest version of Evil and with GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4).

Comments (6)

  1. Titus von der Malsburg reporter

    Strange, it happens only sometimes. I can't pin down what triggers it, but the font size (which I change with (text-scale-adjust 1)) seems to be a factor. For some sizes if happens more often than for others. It also doesn't occur in all columns but only in some.

  2. Frank Fischer repo owner
    • changed status to open

    What Michael said is know to me, I just haven't find the time to fix it yet. It has something to do with evil's new behavior of hiding the final (empty) line in a buffer. When (point) is moved to this line (i.e., if it's move to (point-max)) it's automatically moved back to the previous line. Unfortunately this does not work well with the 'preserve-column' stuff.

  3. Frank Fischer repo owner

    Add `evil-with-adjust-cursor' macro

    Several motions wrap their code within this macro instead of calling `evil-adjust-cursor'. This macro works by narrowing the buffer to (1- (point-max)) if the buffer ends in a newline character. Thus the motion does not reach the original (point-max) at all. This has the advantage that the cursor has not to be moved back the correct column in the previous line. This addresses issue #119.

    Wiki macro error: Changeset 86d7c0a7129b not found.

  4. Anonymous

    Sorry for not responding earlier. Frank's patch didn't fix my problem. However, I just updated to a newer version of Emacs and the issue is gone now. It was apparently a problem in Emacs. Thanks.

  5. Log in to comment