Closed svictor9 closed 2 years ago
My recommendation is to adjust truncate-lines
:
(add-hook 'icomplete-minibuffer-setup-hook
(lambda () (setq truncate-lines t)))
As an alternative one could also right trim annotations if marginalia-align=left
.
(advice-add #'marginalia--align :filter-return #'marginalia-trim-right)
(defun marginalia-trim-right (list)
(cl-loop for (cand prefix suffix) in list collect
(list cand prefix (string-trim-right suffix))))
Marginalia doesn't do this currently, it formats all annotations to a fixed width and pads with whitespace.
Thanks! Both methods solve the problem when the emacs window is maximized. However, only the first one seems to work when the window is smaller than maximum (tested at 71 cols)
Another problem is that once the padding is enlarged it doesn't shrink back. Consider the two screenshots in the first post: with the input "marg" the padding is increased, compared to "mar". I suppose that this is normal behavior and has to do with the collected results. But if I then delete the last "g", I would expect the padding to be smaller again. In effect, the large padding remains, and the results are still truncated. I can live with that of course, but I'm not sure it's normal behavior.
Thanks! Both methods solve the problem when the emacs window is maximized. However, only the first one seems to work when the window is smaller than maximum (tested at 71 cols)
Sure. The second method does not truncate the line, so you will still get wrapping, but not because of the whitespace padding.
Another problem is that once the padding is enlarged it doesn't shrink back. Consider the two screenshots in the first post: with the input "marg" the padding is increased, compared to "mar". I suppose that this is normal behavior and has to do with the collected results. But if I then delete the last "g", I would expect the padding to be smaller again. In effect, the large padding remains, and the results are still truncated. I can live with that of course, but I'm not sure it's normal behavior.
Yes, this is expected and usually not a problem, since deleting input characters during filtering happens rarely. Marginalia remembers the maximal length of the candidates and adjusts the alignment accordingly. If Marginalia wouldn't do this, we would see a lot of jumping during filtering and scrolling.
I understand. All clear, thanks!
I use marginalia with
icomplete-vertical-mode
(the one built into Emacs 29)The results of, say,
describe-variable
sometimes wrap at the window edge. I would like to understand why, and to get rid of that wrapping if possible. What is weird is that the wrapping doesn't depend on the window size. I attach two outputs ofdescribe-variable
.With the input "mar", it doesn't wrap
With the input "marg", it wraps
Why is that? How could I get rid of the wrapping in the second case?