diff options
| author | Brian Leung <leungbk@posteo.net> | 2022-02-10 19:54:28 -0800 |
|---|---|---|
| committer | Tom Dalziel <33435574+tomdl89@users.noreply.github.com> | 2022-02-14 00:00:33 +0100 |
| commit | 4ed0543c9235f97748d4a4913cfdce03fee0e17c (patch) | |
| tree | 227b418dd397453b4e95c906d68424a5b59119b4 | |
| parent | e7c019291bb2746fc8243e140dc95229728aee50 (diff) | |
evil-read: Make point end up at the last line of any shell output
| -rw-r--r-- | evil-commands.el | 6 | ||||
| -rw-r--r-- | evil-tests.el | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/evil-commands.el b/evil-commands.el index 7c6a299..ff8ee3f 100644 --- a/evil-commands.el +++ b/evil-commands.el @@ -3205,9 +3205,9 @@ If no FILE is specified, reload the current buffer from disk." (unless (bolp) (insert "\n"))))) (t (shell-command (evil-ex-replace-special-filenames (substring file 1)) t) - (save-excursion - (goto-char (mark)) - (unless (bolp) (insert "\n"))))))) + (goto-char (mark)) + (unless (bolp) (insert "\n")) + (forward-line -1))))) (evil-define-command evil-show-files () "Shows the file-list. diff --git a/evil-tests.el b/evil-tests.el index eb638cf..0e313b5 100644 --- a/evil-tests.el +++ b/evil-tests.el @@ -8149,6 +8149,13 @@ maybe we need one line more with some text\n") (buffer-file-name) "\n" "2\n" "1\n"))))) + (ert-info ("Ensure that point ends up at the last line of shell output, if any") + (evil-with-temp-file name + "3\n2\n1\n" + (evil-test-buffer + "[l]ine 1\nline 2" + ((vconcat ":read !cat " name [return])) + "line 1\n3\n2\n[1]\nline 2"))) (ert-info ("Test insertion of shell command without trailing newline") (ert-info ("with space") (evil-test-buffer |
