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'." "Toggle the direction that the prompt points according to `p11k/get-modal-status'."
(save-match-data (save-match-data
(save-mark-and-excursion (save-mark-and-excursion
(let ((inhibit-read-only t) (if (re-search-backward eshell-prompt-regexp nil 'no-error)
(new-caret (let ((inhibit-read-only t)
(p11k/caret-color-status (new-caret
eshell-last-command-status))) (p11k/caret-color-status
(goto-char (point-max)) eshell-last-command-status)))
(re-search-backward eshell-prompt-regexp) (goto-char (point-max))
(goto-char (point-at-bol)) (re-search-backward eshell-prompt-regexp)
(delete-forward-char 1) (goto-char (point-at-bol))
(insert new-caret)) (delete-forward-char 1)
(insert new-caret)))
))) )))
(defun p11k/esh-transient-prompt () (defun p11k/esh-transient-prompt ()