Fix the bug of visual caret deleting everything

This commit is contained in:
Miranda Marquez 2024-09-09 18:45:21 -08:00
parent c9ca487475
commit caef820683

View File

@ -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)))