From caef8206832d363bcb022bc0bbbb540c01083649 Mon Sep 17 00:00:00 2001 From: Miranda Marquez Date: Mon, 9 Sep 2024 18:45:21 -0800 Subject: [PATCH] Fix the bug of visual caret deleting everything --- p11k.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/p11k.el b/p11k.el index 70a056c..bd6902a 100644 --- a/p11k.el +++ b/p11k.el @@ -310,12 +310,19 @@ Use 'window-width' to calculate the total final width." (p11k/caret-color-status eshell-last-command-status) " "))))) +(defun mir/last-line-p () + "Return t if the point is on the last line of current buffer." + (eq + (point-max) + (point-at-eol))) (defun p11k/modal-caret (&optional throwaway) "Toggle the direction that the prompt points according to `p11k/get-modal-status'." (save-match-data (save-mark-and-excursion + (goto-char (point-max)) (if (re-search-backward eshell-prompt-regexp nil 'no-error) (let ((inhibit-read-only t) + (delete-active-region nil) (new-caret (p11k/caret-color-status eshell-last-command-status)))