don't modify prompt if it isn't there

This commit is contained in:
Miranda Marquez 2024-04-07 15:41:14 -08:00
parent 2de038abaf
commit 3294ba546e

19
p11k.el
View File

@ -303,15 +303,16 @@ Use 'window-width' to calculate the total final width."
"Toggle the direction that the prompt points according to `p11k/get-modal-status'."
(save-match-data
(save-mark-and-excursion
(let ((inhibit-read-only t)
(new-caret
(p11k/caret-color-status
eshell-last-command-status)))
(goto-char (point-max))
(re-search-backward eshell-prompt-regexp)
(goto-char (point-at-bol))
(delete-forward-char 1)
(insert new-caret))
(if (re-search-backward eshell-prompt-regexp nil 'no-error)
(let ((inhibit-read-only t)
(new-caret
(p11k/caret-color-status
eshell-last-command-status)))
(goto-char (point-max))
(re-search-backward eshell-prompt-regexp)
(goto-char (point-at-bol))
(delete-forward-char 1)
(insert new-caret)))
)))
(defun p11k/esh-transient-prompt ()