diff --git a/lisp/tramp.el b/lisp/tramp.el index 910d5343..a44f8d1b 100644 --- a/lisp/tramp.el +++ b/lisp/tramp.el @@ -624,9 +624,7 @@ Sometimes the prompt is reported to look like \"login as:\"." ;; connection initialization; Tramp redefines the prompt afterwards. (rx (| bol "\r") (* (not (any "\n#$%>]"))) - (? "#") (any "#$%>]") (* blank) - ;; Escape characters. - (* "[" (* (any ";" digit)) alpha (* blank))) + (? "#") (any "#$%>]") (* blank)) "Regexp to match prompts from remote shell. Normally, Tramp expects you to configure `shell-prompt-pattern' correctly, but sometimes it happens that you are connecting to a @@ -5883,11 +5881,14 @@ Otherwise, return nil." "Check, whether REGEXP is contained in process buffer of PROC. Erase echoed commands if exists." (with-current-buffer (process-buffer proc) - (goto-char (point-min)) + ;; Remove color escape sequences from shell prompt. + (while (tramp-search-regexp tramp-display-escape-sequence-regexp) + (replace-match "")) ;; Check whether we need to remove echo output. The max length of ;; the echo mark regexp is taken for search. We restrict the ;; search for the second echo mark to PIPE_BUF characters. + (goto-char (point-min)) (when (and (tramp-get-connection-property proc "check-remote-echo") (re-search-forward tramp-echoed-echo-mark-regexp