Skip to content

feat: nerd icons support#5

Open
edelars wants to merge 1 commit intokooler:mainfrom
edelars:feature/icons-support
Open

feat: nerd icons support#5
edelars wants to merge 1 commit intokooler:mainfrom
edelars:feature/icons-support

Conversation

@edelars
Copy link
Copy Markdown

@edelars edelars commented Apr 4, 2026

feat: nerd icons support

feat: nerd icons support
Copy link
Copy Markdown
Owner

@kooler kooler left a comment

Choose a reason for hiding this comment

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

Great addition! Please see a few small issues below.

Comment on lines +124 to +125
iconSpace := iconWidth + iconPadding
nameWidth := width - iconSpace - sizeWidth - timeWidth - 2 // 2 spaces between columns
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

it seems that name column shrinks by 1 char even when icons are disabled. When icons are disabled (the default), ResolveIcon returns "" and iconWidth stays 0, but iconPadding (1) is still subtracted.

The rendered row is 1 cell shorter than innerWidth, so the cursor/selection background highlight and the right border no longer reach the right edge.

if icon == "" {
return 0
}
return utf8.RuneCountInString(icon)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Many Nerd Font glyphs render as 2 terminal cells (East-Asian Wide / ambiguous-width in some terminals, and several nf-md-* / nf-custom-* glyphs are definitively 2 cells). utf8.RuneCountInString always returns 1 for a single-rune icon and will miscount those, causing the name column to be off by one.

Probably better to use runewidth.StringWidth(icon).

Comment on lines +58 to +60
if icon, ok := r.extIcons[strings.ToLower(ext)]; ok {
return icon
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Setting a user extension to "" produces a broken row.

A user who wants to disable the default icon for .go by writing go = "" will get:

Lets pick one of:

  • Treat empty as "fall back to default file icon" (if icon, ok := ...; ok && icon != "" { return icon }), OR
  • Document explicitly that empty strings are reserved / not allowed in [icons.extensions].

Comment thread .gitignore
dist/
QWEN.md
prompts/
.gitignore
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

gitnoreception :-)

Probably a mistake.

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.

2 participants