Skip to content

Commit b563d2c

Browse files
authored
Merge pull request #879 from yorukot/disable_nerdfont
enhance: add detailed documentation for InitIcon function and update …
2 parents 14f551e + c8b7265 commit b563d2c

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

src/config/icon/function.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
package icon
22

3+
// InitIcon initializes the icon configuration for the application.
4+
// It sets up different icons based on whether nerd fonts are enabled and configures directory icon colors.
5+
//
6+
// Parameters:
7+
// - nerdfont: boolean flag to determine if nerd fonts should be used
8+
// When false, uses simple ASCII characters for icons
9+
// When true, uses nerd font icons (default behavior)
10+
// - directoryIconColor: string representing the color for directory icons
11+
// If empty, defaults to "NONE" (dark yellowish)
12+
//
13+
// The function configures various icons for:
14+
// - System directories (Home, Download, Documents, etc.)
15+
// - File operations (Compress, Extract, Copy, Cut, Delete)
16+
// - UI elements (Cursor, Browser, Select, etc.)
17+
// - Status indicators (Error, Warn, Done, InOperation)
18+
// - Navigation and sorting (Directory, Search, SortAsc, SortDesc)
319
func InitIcon(nerdfont bool, directoryIconColor string) {
420
// Make sure that these alternatives are ASCII characters only.
521
// Dont place any special unicode characters here.
622
if !nerdfont {
7-
// Do we need this to be empty ? Maybe it should just be normal space ?
23+
// When nerdfont is disabled, we use simple ASCII characters
24+
// Space is set to empty string because we don't need special spacing
25+
// for ASCII characters, unlike nerd fonts which often need proper spacing
26+
// to display correctly
827
Space = ""
928
SuperfileIcon = ""
1029

@@ -36,6 +55,7 @@ func InitIcon(nerdfont bool, directoryIconColor string) {
3655
Search = ""
3756
SortAsc = "^"
3857
SortDesc = "v"
58+
Terminal = ""
3959
Pinned = ""
4060
Disk = ""
4161
}

src/internal/ui/prompt/model.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,9 @@ func DefaultModel(maxHeight int, width int) Model {
1818
common.Hotkeys.OpenCommandLine[0], common.Config.ShellCloseOnSuccess, maxHeight, width)
1919
}
2020

21-
func getHeadLine() string {
22-
if common.Config.Nerdfont {
23-
return icon.Terminal + " "
24-
}
25-
return ""
26-
}
27-
2821
func GenerateModel(spfPromptHotkey string, shellPromptHotkey string, closeOnSuccess bool, maxHeight int, width int) Model {
2922
m := Model{
30-
headline: getHeadLine() + promptHeadlineText,
23+
headline: icon.Terminal + icon.Space + promptHeadlineText,
3124
open: false,
3225
shellMode: true,
3326
textInput: common.GeneratePromptTextInput(),

0 commit comments

Comments
 (0)