Issue #209 resolved

Not moving cursor to prompt in comint-like modes

Jean-Christophe Petkovich
created an issue

In modes that are "comint-like" evil does not appear to move the cursor to the new prompt upon the completion of a command.

This can be reproduced in emacs 24.2.1 and when running with emacs -Q with evil as the only loaded extension. The commit I'm using to reproduce the problem is ebd97ad4d192b17611b6805884293b43a68b1360

To better illustrate what the problem is, here is an example: when using eshell and running git status I notice that emacs moves the cursor to the beginning of the line where the command was entered (cursor = <|>):

Before entering:

~ $ git status <|>

After entering:

<|>~ $ git status
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
~ $

This only seems to happen with certain commands and I can't seem to track down the source of this problem.

I did however go back to an earlier version to double check that it wasen't happening before. The last commit that I was using on my computer which did not exhibit the behaviour was 694edbfd9e60d1607455e31e243b0d545861c07a so the problem must have arisen between those two commits.

Comments (8)

  1. Jean-Christophe Petkovich reporter

    Just wrote a quick a work-around based on the information from the commit, not really a fix but it at least alleviates the problem until a proper fix can be had.

    (defadvice eshell-send-input (before switch-to-normal-mode activate)
      (evil-execute-in-emacs-state 1))
    (defadvice slime-repl-return (before switch-to-normal-mode activate)
      (evil-execute-in-emacs-state 1))
  2. Frank Fischer repo owner

    Remove adjustment of point after the final newline of a buffer

    This patch makes an empty line appear after the final newline in a buffer. This is different to Vim which shows no empty line beyond that final newline, but this behavior is more consistent with Emacs. Some Emacs modes depend on that final newline not being hidden, so the old behavior causes some trouble when evil is used in such modes.

    Besides removing the line adjustment, several commands (change, delete) had been modified. These commands cannot rely on each line ending in a newline anymore, but must deal with the situation that some line does not end in a newline (in particular, the last visible line of buffer) explicitly. Note that most other commands do not interact with empty lines at all, so they do not need to take care of that empty line at the end of the buffer.

    This addresses #190. This addresses #198. This addresses #209. This addresses #221.

    → <<cset 394e8be4fac1>>

  3. Log in to comment