Skip to content

Commit

Permalink
Fix deletion of extra space inserted (#1273).
Browse files Browse the repository at this point in the history
* helm-eshell.el (helm-esh-pcomplete): Do it.
  • Loading branch information
thierryvolpiatto committed Nov 26, 2015
1 parent 31fdb6d commit 752557a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions helm-eshell.el
Expand Up @@ -202,14 +202,15 @@ The function that call this should set `helm-ec-target' to thing at point."
(eshell-backward-argument 1) (point))
end)))
(first (car args)) ; Maybe lisp delimiter "(".
last) ; Will be the last but parsed by pcomplete.
last ; Will be the last but parsed by pcomplete.
del-space)
(setq helm-ec-target (or target " ")
end (point)
;; Reset beg for `with-helm-show-completion'.
beg (or (and target (not (string= target " "))
(- end (length target)))
;; Nothing at point.
(progn (insert " ") (point))))
(progn (insert " ") (setq del-space t) (point))))
(cond ((eq first ?\()
(helm-lisp-completion-or-file-name-at-point))
;; In eshell `pcomplete-parse-arguments' is called
Expand All @@ -223,12 +224,13 @@ The function that call this should set `helm-ec-target' to thing at point."
(car (last (ignore-errors
(pcomplete-parse-arguments))))))
(with-helm-show-completion beg end
(helm :sources (helm-make-source "Eshell completions" 'helm-esh-source)
:buffer "*helm pcomplete*"
:keymap helm-esh-completion-map
:resume 'noresume
:input (and (stringp last)
(helm-ff-set-pattern last))))))))
(or (helm :sources (helm-make-source "Eshell completions" 'helm-esh-source)
:buffer "*helm pcomplete*"
:keymap helm-esh-completion-map
:resume 'noresume
:input (and (stringp last)
(helm-ff-set-pattern last)))
(and del-space (delete-char -1))))))))

;;;###autoload
(defun helm-eshell-history ()
Expand Down

0 comments on commit 752557a

Please sign in to comment.