Closed gusbrs closed 1 year ago
When doing file completion and the path gets long enough to need a second line, the marginalia annotations are disrupted and also wrap lines. To reproduce:
The behavior is as intended. The point is that the prompt should be visible completely (truncate-lines=nil). We sacrifice readability of the annotations.
Besides, if truncation affected the prompt line, I would no longer see what I'm completing.
Indeed. That's why.
See https://github.com/minad/vertico/blob/eba9e47947f2ea24c6b1c48b1c9475c220fc24a7/vertico.el#L549
Ok, thanks for taking a look.
But there's still something I don't understand, and perhaps I haven't chosen the best path example because the files inside the directory are also long. However, even if the file names are short, the annotation wrapping occurs, for example:
Is this because the annotations have been pushed to the right along the completion path? If that's the case, would it be possible to "reset" the annotations' padding every time we change directory level?
Edit: Indeed, if I start the completion from the test/
directory, the result is different:
I don't know. I assume this has to do with the alignment (space display property pushes the annotation to the right). If you have an idea to improve this, please let me know (I mean concretely in the form of code).
Is this because the annotations have been pushed to the right along the completion path? If that's the case, would it be possible to "reset" the annotations' padding every time we change directory level?
EDIT: Indeed, that's the reason. Marginalia remembers the width of the candidates. EDIT2: Fixed in https://github.com/minad/marginalia/commit/98deaa8fad107c564b8ab9a5b13386d05f9415da.
I think my thought there would be interesting. For file name completion, whenever we change directories, we got a new set of candidates, so the padding of the annotations for the previous directory level is not really that relevant. I presume regularly marginalia doesn't "shrink" the annotations back along the completion session because it would be jarring. But in the case of file names and paths that would make sense. Don't you think? What I don't know is there's a way to know when we changed directory levels. Do you?
@gusbrs Yes, it is trivial and already fixed.
Oh! You commit faster than I can comment back! :-) Thank you!
When doing file completion and the path gets long enough to need a second line, the marginalia annotations are disrupted and also wrap lines. To reproduce:
Start with
emacs -Q
, do a minimal setup:Start
find-file
, and navigate to a path deep enough that the prompt plus current completed path wraps the line. As an example, I get:toggle-truncate-lines
("C-x x t") does not help here,marginalia-cycle
does:Probably related to https://github.com/minad/marginalia/issues/142 , but I tried line truncation with both
toggle-truncate-lines
and with:With no change. Besides, if truncation affected the prompt line, I would no longer see what I'm completing.
(Running GNU Emacs 28.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-09-12, and the packages' versions loaded above).