Fix bug in eshell-starship

This commit is contained in:
Alexander Rosenberg 2025-06-21 19:50:23 +09:00
parent 19d559d626
commit 73530f887f
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -99,6 +99,9 @@ FIELD should be one of the keys in `eshell-starship--modules-by'."
"A list of (NAME IS-DIR MODULE). "A list of (NAME IS-DIR MODULE).
These represent files that cannot be stored in `eshell-starship--module-by'.") These represent files that cannot be stored in `eshell-starship--module-by'.")
(defvar-local eshell-starship--is-first-prompt t
"Non-nil if we have never printed a prompt in this buffer.")
;;; Module API ;;; Module API
(defvar eshell-starship-modules (make-hash-table :test 'equal) (defvar eshell-starship-modules (make-hash-table :test 'equal)
@ -988,8 +991,11 @@ Return a hash table mapping module names to their output."
(defun eshell-starship--render-prompt () (defun eshell-starship--render-prompt ()
"Actually produce the prompt." "Actually produce the prompt."
(concat (concat
(unless (<= (line-number-at-pos) 3) (prog1
(unless (or eshell-starship--is-first-prompt
(zerop (buffer-size)))
"\n") "\n")
(setq eshell-starship--is-first-prompt nil))
(let ((mods (eshell-starship--build-module-string))) (let ((mods (eshell-starship--build-module-string)))
(add-face-text-property 0 (length mods) 'default t mods) (add-face-text-property 0 (length mods) 'default t mods)
mods))) mods)))