Skip to content

fix(#3124): fix icon padding for "right_align" placements, notably for dotfiles #3125

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

Merged

Conversation

rossw01
Copy link
Contributor

@rossw01 rossw01 commented May 11, 2025

fixes #3124

Bug is caused in builder.lua:

for _, d in ipairs(self.decorators) do
  add_to_end(rights, d:icons_right_align(not d:is(UserDecorator) and node or api_node))
end

In the case of tracked dotfiles, d:icons_right_align(not d:is(UserDecorator) and node or api_node) returns {} from the HiddenDecorator, but inside add_to_end(t1, t2) we only check if not t2. Not sure if this was intentional, I didn't notice any unexpected behaviour while testing but there may be edge cases I hadn't thought of.

@rossw01 rossw01 changed the title fix(#3124): prevent empty icons_right response from breaking padding fix(#3124): prevent empty icons_right_align response from breaking padding May 11, 2025
@alex-courtis
Copy link
Member

Not sure if this was intentional, I didn't notice any unexpected behaviour while testing but there may be edge cases I hadn't thought of.

That was not intentional; it was a bad copy-paste when creating the decorator classes. The same issue occurs for modified and this fix resolves it as well.

From the comment it looks like the :icons method originally tested self.explorer.opts.renderer.icons.show.git and similar, however that test was moved to the constructor. There's no need to change that as this fix covers it and will assist people with user decorators.

@alex-courtis alex-courtis changed the title fix(#3124): prevent empty icons_right_align response from breaking padding fix(#3124): fix icon padding for "right_align" placements, notably for dotfiles May 18, 2025
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for your contribution!

@alex-courtis alex-courtis merged commit e4cd856 into nvim-tree:master May 18, 2025
7 checks passed
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

Successfully merging this pull request may close these issues.

Git icons for dotfiles have no padding if right aligned
2 participants