@@ -15,16 +15,16 @@ import (
1515 "github.com/charmbracelet/x/exp/term/ansi"
1616)
1717
18- func TruncateText (text string , maxChars int , talis string ) string {
19- truncatedText := ansi .Truncate (text , maxChars - len (talis ), "" )
18+ func TruncateText (text string , maxChars int , tails string ) string {
19+ truncatedText := ansi .Truncate (text , maxChars - len (tails ), "" )
2020 if text != truncatedText {
21- return truncatedText + talis
21+ return truncatedText + tails
2222 }
2323
2424 return text
2525}
2626
27- func TruncateTextBeginning (text string , maxChars int , talis string ) string {
27+ func TruncateTextBeginning (text string , maxChars int , tails string ) string {
2828 if ansi .StringWidth (text ) <= maxChars {
2929 return text
3030 }
@@ -38,27 +38,27 @@ func TruncateTextBeginning(text string, maxChars int, talis string) string {
3838 truncatedWidth = ansi .StringWidth (string (truncatedRunes ))
3939 }
4040
41- if len (truncatedRunes ) > len (talis ) {
42- truncatedRunes = append ([]rune (talis ), truncatedRunes [len (talis ):]... )
41+ if len (truncatedRunes ) > len (tails ) {
42+ truncatedRunes = append ([]rune (tails ), truncatedRunes [len (tails ):]... )
4343 }
4444
4545 return string (truncatedRunes )
4646}
4747
48- func TruncateMiddleText (text string , maxChars int , talis string ) string {
48+ func TruncateMiddleText (text string , maxChars int , tails string ) string {
4949 if utf8 .RuneCountInString (text ) <= maxChars {
5050 return text
5151 }
5252
5353 halfEllipsisLength := (maxChars - 3 ) / 2
54-
55- truncatedText := text [:halfEllipsisLength ] + talis + text [utf8 .RuneCountInString (text )- halfEllipsisLength :]
54+ // Todo : Use ansi.Substring to correctly handle ANSI escape codes
55+ truncatedText := text [:halfEllipsisLength ] + tails + text [utf8 .RuneCountInString (text )- halfEllipsisLength :]
5656
5757 return truncatedText
5858}
5959
6060func PrettierName (name string , width int , isDir bool , isSelected bool , bgColor lipgloss.Color ) string {
61- style := GetElementIcon (name , isDir )
61+ style := GetElementIcon (name , isDir , Config . Nerdfont )
6262 if isSelected {
6363 return StringColorRender (lipgloss .Color (style .Color ), bgColor ).
6464 Background (bgColor ).
@@ -73,15 +73,15 @@ func PrettierName(name string, width int, isDir bool, isSelected bool, bgColor l
7373}
7474
7575func PrettierDirectoryPreviewName (name string , isDir bool , bgColor lipgloss.Color ) string {
76- style := GetElementIcon (name , isDir )
76+ style := GetElementIcon (name , isDir , Config . Nerdfont )
7777 return StringColorRender (lipgloss .Color (style .Color ), bgColor ).
7878 Background (bgColor ).
7979 Render (style .Icon + " " ) +
8080 FilePanelStyle .Render (name )
8181}
8282
8383func ClipboardPrettierName (name string , width int , isDir bool , isSelected bool ) string {
84- style := GetElementIcon (name , isDir )
84+ style := GetElementIcon (name , isDir , Config . Nerdfont )
8585 if isSelected {
8686 return StringColorRender (lipgloss .Color (style .Color ), FooterBGColor ).
8787 Background (FooterBGColor ).
@@ -152,8 +152,8 @@ func IsBufferPrintable(buffer []byte) bool {
152152 return true
153153}
154154
155- // IsExensionExtractable checks if a string is a valid compressed archive file extension.
156- func IsExensionExtractable (ext string ) bool {
155+ // IsExtensionExtractable checks if a string is a valid compressed archive file extension.
156+ func IsExtensionExtractable (ext string ) bool {
157157 // Extensions based on the types that package: `xtractr` `ExtractFile` function handles.
158158 validExtensions := map [string ]struct {}{
159159 ".zip" : {},
0 commit comments