branch: elpa/helm
commit b19cd01e165bc5138c527ed8f07d8aa30a97e432
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    Fix previous commit, recenter only when deleting and preselecting
---
 helm-core.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index 6e70061336..410f01baf1 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -6559,8 +6559,7 @@ CANDIDATE-OR-REGEXP from there."
     (when helm-allow-mouse
       (helm--mouse-reset-selection-help-echo))
     (helm-mark-current-line)
-    ;; helm-force-update is already recentering.
-    (unless (or helm--force-updating-p (not (helm-window))) (recenter))
+    (when helm--deleting-minibuffer-contents-from (recenter))
     (helm-display-mode-line (or source (helm-get-current-source)))
     (helm-log-run-hook "helm-preselect" 'helm-after-preselection-hook)))
 
@@ -6629,10 +6628,14 @@ Used generally to modify current selection."
   `(helm--edit-current-selection-internal
     (lambda () ,@forms)))
 
+(defvar helm--deleting-minibuffer-contents-from nil
+  "[INTERNAL] Recenter when deleting minibuffer-contents and preselecting.
+This is a flag used internally.")
 (defun helm--delete-minibuffer-contents-from (from-str &optional presel)
   ;; Giving an empty string value to FROM-STR delete all.
   (let ((input (minibuffer-contents))
         (src (and presel (helm-get-current-source)))
+        (helm--deleting-minibuffer-contents-from presel)
         helm-move-to-line-cycle-in-source)
     (helm-reset-yank-point)
     (unless (zerop (length input))

Reply via email to