(setq-local eshell-last-output-end (point-marker))
(setq-local eshell-last-output-block-begin (point))
+ (add-function :filter-return (local 'filter-buffer-substring-function)
+ #'eshell--unmark-string-as-output)
+
(let ((modules-list (copy-sequence eshell-modules-list)))
(setq-local eshell-modules-list modules-list))
(eshell--mark-as-output start1 end1)))))
(add-hook 'after-change-functions hook nil t)))
+(defun eshell--unmark-string-as-output (string)
+ "Unmark STRING as Eshell output."
+ (remove-list-of-text-properties
+ 0 (length string)
+ '(rear-nonsticky front-sticky field insert-in-front-hooks)
+ string)
+ string)
+
(defun eshell-find-delimiter
(open close &optional bound reverse-p backslash-p)
"From point, find the CLOSE delimiter corresponding to OPEN.
(eshell-send-input)
(eshell-match-output "(\"hello\" \"there\")")))
+(ert-deftest eshell-test/yank-output ()
+ "Test that yanking a line of output into the next prompt works (bug#66469)."
+ (with-temp-eshell
+ (eshell-insert-command "echo hello")
+ ;; Go to the output and kill the line of text.
+ (forward-line -1)
+ (kill-line)
+ ;; Go to the last prompt and yank the previous output.
+ (goto-char (point-max))
+ (yank)
+ ;; Go to the beginning of the prompt and add some text.
+ (move-beginning-of-line 1)
+ (insert-and-inherit "echo ")
+ ;; Make sure when we go to the beginning of the line, we go to the
+ ;; right spot (before the "echo").
+ (move-end-of-line 1)
+ (move-beginning-of-line 1)
+ (should (looking-at "echo hello"))))
+
(provide 'eshell-tests)
;;; eshell-tests.el ends here