diff options
-rw-r--r-- | helm-eshell.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/helm-eshell.el b/helm-eshell.el index b4d44ccb..69bee7d4 100644 --- a/helm-eshell.el +++ b/helm-eshell.el @@ -389,9 +389,18 @@ If BUFFER is nil, use current buffer." ;; #27405. (helm-aif (and eshell-highlight-prompt (next-single-property-change (point) 'read-only)) - (progn (goto-char it) (eshell-skip-prompt)) + (progn (goto-char it) (helm-eshell-skip-prompt)) (re-search-forward eshell-prompt-regexp nil t 1))) +(defun helm-eshell-skip-prompt () + "Skip past the text matching regexp `eshell-prompt-regexp'. +If this takes us past the end of the current line, don't skip at all." + (let ((eol (line-end-position))) + (if (and (looking-at eshell-prompt-regexp) + (<= (match-end 0) eol)) + (goto-char (match-end 0)) + (point)))) + (defun helm-eshell-prompts-list-all () "List the prompts of all Eshell buffers. See `helm-eshell-prompts-list'." |