diff --git a/lisp/ess-utils.el b/lisp/ess-utils.el index 3dc7d1422..f32db3a52 100644 --- a/lisp/ess-utils.el +++ b/lisp/ess-utils.el @@ -1024,7 +1024,7 @@ nil and not t, query for each instance." nil)) (defun ess--strip-final-newlines (string) - (replace-regexp-in-string "\n+" "" string)) + (replace-regexp-in-string "\n+$" "" string)) ;;*;; Debugging tools diff --git a/test/ess-test-inf.el b/test/ess-test-inf.el index 5a7402fd0..17e9a56d3 100644 --- a/test/ess-test-inf.el +++ b/test/ess-test-inf.el @@ -201,6 +201,13 @@ Needed with slow-responding processes." ;; There should be no output after the early exit or async restoration :inf-result "") + +(etest-deftest-r ess-command-newlines-test () + "`ess-command' doesn't garble new lines (#1110)." + :eval ((should (string= (ess--strip-final-newlines "1\n2") + "1\n2")) + (should (equal (ess-get-words-from-vector "{ 'foo'\n'bar'\n }\n") + (list "bar"))))) ;;*;; Inferior interaction