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

Having icons causes issues with the new marginalia alignment logic #12

Open
iyefrat opened this issue Jan 14, 2022 · 3 comments
Open

Having icons causes issues with the new marginalia alignment logic #12

iyefrat opened this issue Jan 14, 2022 · 3 comments

Comments

@iyefrat
Copy link
Owner

iyefrat commented Jan 14, 2022

I've only noticed this in file annotations, but I assume this is a general problem.

Probably stems from the marginalia alignment logic assuming that there will no extra things it doesn't know about.

cc @minad

@minad
Copy link

minad commented Jan 14, 2022

Yes, you probably have to adjust to the new alignment logic. Either adjust the marginalia-align-offset by the width of the icons if maginalia-align=left or rewrite the annotations such that you add the additional offset manually.

@protesilaos
Copy link
Contributor

I have noticed some alignment issues regardless of Marginalia. Changing
all spaces to tabs seems to improve things, though the spacing is less
tight than before. I suppose this should ultimately be changed to use a
different alignment method, like how all-the-icons-dired.el does it.

[ This is not a patch. Just to share the idea. ]

 all-the-icons-completion.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/all-the-icons-completion.el b/all-the-icons-completion.el
index 609e147..3db4586 100644
--- a/all-the-icons-completion.el
+++ b/all-the-icons-completion.el
@@ -54,15 +54,15 @@ (defun all-the-icons-completion-get-icon (cand cat)
     (file (all-the-icons-completion-get-file-icon cand))
     (project-file (all-the-icons-completion-get-file-icon cand))
     (buffer (all-the-icons-completion-get-buffer-icon cand))
-    (t "")))
+    (t "\t")))
 
 (defun all-the-icons-completion-get-file-icon (cand)
   "Return the icon for the candidate CAND of completion category file."
   (cond ((file-directory-p cand)
          (concat
           (all-the-icons-icon-for-dir cand :face 'all-the-icons-completion-dir-face)
-          " "))
-        (t (concat (all-the-icons-icon-for-file cand) " "))))
+          "\t"))
+        (t (concat (all-the-icons-icon-for-file cand) "\t"))))
 
 (defun all-the-icons-completion-get-buffer-icon (cand)
   "Return the icon for the candidate CAND of completion category buffer."
@@ -76,7 +76,7 @@ (defun all-the-icons-completion-get-buffer-icon (cand)
              (all-the-icons-faicon "sticky-note-o")
            parent-icon)
        icon)
-     " ")))
+     "\t")))
 
 (defun all-the-icons-completion-completion-metadata-get (orig metadata prop)
   "Meant as :around advice for `completion-metadata-get', Add icons as prefix.

Before VS After (notice the purple block in the Completions)

2022-01-21_10:28:21_2560x1062

2022-01-21_10:28:43_2560x1062

Before VS After with Marginalia

2022-01-21_10:29:48_2560x1062

2022-01-21_10:29:59_2560x1062

@iyefrat
Copy link
Owner Author

iyefrat commented Jan 21, 2022

This is actually a separate alignment bug, I'll look into how all-the-icons-dired solves this. Weirdly, now I can't reproduce the original bug. I should have taken a screenshot, but it involved the right-most annotations not being aligned. I'll keep this open for a while in case I run into this again, If not I'll close it.

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

3 participants