diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2018-03-09 17:22:22 +0100 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2018-03-09 17:22:22 +0100 |
commit | 93cbf010a3452fbce7ee3b58b70935be8c444cd9 (patch) | |
tree | d58c3480252b2c32934b0ffc26580ecf7404e849 /helm-eshell.el | |
parent | 87dae7cbdda0695a9425ebf1880b19ce10741520 (diff) |
Fix eshell-skip-prompt and inline (#1977)
* helm-eshell.el (helm-eshell-skip-prompt): New.
(helm-eshell-next-prompt): Use it.
Diffstat (limited to 'helm-eshell.el')
-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'." |