Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request: don't delete right side of minibuffer after TAB #463

Closed
Anoncheg1 opened this issue Mar 29, 2024 · 1 comment
Closed

Pull request: don't delete right side of minibuffer after TAB #463

Anoncheg1 opened this issue Mar 29, 2024 · 1 comment

Comments

@Anoncheg1
Copy link

Anoncheg1 commented Mar 29, 2024

Fucking github don't allow me to create a fork! What the hell wrong with that world! Github is a stupid shit.

Case: in Dired when you want to copy file you enter path and you don't want filename at right side to be deleted duiring composing new path.
Another case when you rename or move file you need completion and preserve pointer.

(defun vertico-exit (&optional arg)
  "Exit minibuffer with current candidate or input if prefix ARG is given."
  (interactive "P")
  (when (and (not arg) (>= vertico--index 0))
    (vertico-insert t))
  (when (vertico--match-p (minibuffer-contents-no-properties))
    (exit-minibuffer)))

(defun vertico-insert (&optional exit-flag)
  "Insert current candidate in minibuffer."
  (interactive)
  (when (> vertico--total 0)
    (let ((vertico--index (max 0 vertico--index)))
      (if exit-flag ; - RET
          (insert (prog1
                      (vertico--candidate) ; return value
                    (delete-minibuffer-contents)))
        ;; else - TAB - completion
        ;; concat vartiant and fix // double + reset pointer position after
          (let ((efn (expand-file-name (concat (vertico--candidate) (buffer-substring (point) (point-max)))))
                (pd (- (point-max) (point)))) ; text lenght after pointer
            ;; (print pd)
            (delete-minibuffer-contents)
            (insert efn)
            (if (> pd 0) ; if we renaming preserve pointer after variant
                (goto-char (- (+ (minibuffer-prompt-end) (length (vertico--candidate))) 1 ))))))))
@minad
Copy link
Owner

minad commented Apr 7, 2024

Please watch your language. The notification of this issue did not even reach me since my spam filter must have rejected the mail right away.

@minad minad closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2024
Repository owner locked and limited conversation to collaborators Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants