Fix regexp to get the last non-empty line

This commit is contained in:
shg 2023-09-28 23:56:58 +09:00 committed by Valentin Boettcher
parent f84208434d
commit 8eff5bde44
No known key found for this signature in database
GPG key ID: E034E12B7AF56ACE

View file

@ -195,7 +195,11 @@ Return a corresponding symbol or nil if not ready for input."
(let* ((bs (buffer-string))
(tail (substring bs (- (min 256 (length bs))))))
(set-text-properties 0 (length tail) nil tail)
(let* ((lines (split-string (string-trim-right tail "[\t\n\r]+")
(let* ((lines (split-string (string-trim-right
(replace-regexp-in-string
(rx (1+ bol (0+ whitespace) eol))
"" tail)
"[\t\n\r]+")
(char-to-string ?\n)))
(prompt (car (last lines))))
(pcase prompt