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

vertico--format-candidate adds an extra whitespace #269

Closed
manuel-uberti opened this issue Aug 24, 2022 · 2 comments
Closed

vertico--format-candidate adds an extra whitespace #269

manuel-uberti opened this issue Aug 24, 2022 · 2 comments

Comments

@manuel-uberti
Copy link
Contributor

Hi,

first of all, this is a minor glitch so feel free to ignore the problem. Since I do not use marginalia, I customize vertico-current with :extend set to nil:

(set-face-attribute 'vertico-current nil :extend nil)

However, it seems like vertico--format-candidate adds a whitespace at the end of the current selected candidate:

1

If I override vertico--format-candidate with the following advice:

(define-advice vertico--format-candidate
    (:override (cand prefix suffix index _start) mu-vertico--format-candidate)
  "Format CAND given PREFIX, SUFFIX and INDEX."
  (setq cand (vertico--display-string (concat prefix cand suffix "\n")))
  (when (= index vertico--index)
    (add-face-text-property 0 (1- (length cand)) 'vertico-current 'append cand))
  cand)

The whitespace is removed:

2

Is it something vertico should take into account or should I just use the advice for this specific use-case? I wouldn't want you to add useless complexity and hacks to vertico just for this.

@minad
Copy link
Owner

minad commented Aug 24, 2022

I see. I think for extend to work we also have to fontify the \n. Therefore we cannot fix this as you proposed.

We could detect if extend is set to nil, but this is a special configuration which is neither common nor recommended.

Why do you dislike extend? In particular with long candidates or Marginalia I prefer the extended highlight.

@minad minad closed this as completed Aug 24, 2022
@manuel-uberti
Copy link
Contributor Author

manuel-uberti commented Aug 24, 2022

To me the highlight makes sense only where there is something to place it upon. Without Marginalia, I see long highlights extended horizontally across the screen with little content in them.

I see your point though, I'll keep the advice in my configuration then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants