Repository: gokcehan/lf (language: go)

Issue:
fixed windows terminal icon colors cut off on overhanging icons
on windows terminal for some reason icon colors are cut off if the icon overhangs this happens on other terminal programs too. the fix is to print a space after the icon with the same style

before:
![before](https://raw.githubusercontent.com/BPplays/images/main/issues/lf/fwt1/before.webp)

after:
![after](https://raw.githubusercontent.com/BPplays/images/main/issues/lf/fwt1/after.webp)


Discussion / hints:

Fix patch:
diff --git a/ui.go b/ui.go
index d3a77e68..72a92f57 100644
--- a/ui.go
+++ b/ui.go
@@ -445,20 +445,21 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
 			maxWidth -= 1
 		}
 
-		var s []rune
-
-		// leave space for displaying the tag
-		s = append(s, ' ')
-
-		var icon iconDef
+		tag := ' '
+		if val, ok := context.tags[path]; ok && len(val) > 0 {
+			tag = rune(val[0])
+		}
 
+		var icon []rune
+		var iconDef iconDef
 		if gOpts.icons {
-			icon = dirStyle.icons.get(f)
-			s = append(s, []rune(icon.icon)...)
-			s = append(s, ' ')
+			iconDef = dirStyle.icons.get(f)
+			icon = append(icon, []rune(iconDef.icon)...)
+			icon = append(icon, ' ')
 		}
 
-		maxFilenameWidth := maxWidth - runeSliceWidth(s)
+		// subtract space for tag and icon
+		maxFilenameWidth := maxWidth - 1 - runeSliceWidth(icon)
 
 		info := fileInfo(f, dir)
 		showInfo := len(info) > 0 && 2*len(info) < maxWidth
@@ -477,40 +478,41 @@ func (win *win) printDir(ui *ui, dir *dir, context *dirContext, dirStyle *dirSty
 		for j := runeSliceWidth(filename); j < maxFilenameWidth; j++ {
 			filename = append(filename, ' ')
 		}
-		s = append(s, filename...)
 
 		if showInfo {
-			s = append(s, []rune(info)...)
+			filename = append(filename, []rune(info)...)
 		}
 
-		ce := ""
 		if i == dir.pos {
+			var cursorFmt string
 			switch dirStyle.role {
 			case Active:
-				ce = gOpts.cursoractivefmt
+				cursorFmt = optionToFmtstr(gOpts.cursoractivefmt)
 			case Parent:
-				ce = gOpts.cursorparentfmt
+				cursorFmt = optionToFmtstr(gOpts.cursorparentfmt)
 			case Preview:
-				ce = gOpts.cursorpreviewfmt
+				cursorFmt = optionToFmtstr(gOpts.cursorpreviewfmt)
 			}
-		}
-		cursorescapefmt := optionToFmtstr(ce)
-
-		s = append(s, ' ')
-		styledFilename := fmt.Sprintf(cursorescapefmt, string(s))
-		win.print(ui.screen, lnwidth+1, i, st, styledFilename)
+			line := append([]rune{tag}, icon...)
+			line = append(line, filename...)
+			line = append(line, ' ')
+			win.print(ui.screen, lnwidth+1, i, st, fmt.Sprintf(cursorFmt, string(line)))
 
-		if icon.hasStyle && i != dir.pos {
-			win.print(ui.screen, lnwidth+2, i, icon.style, icon.icon)
-		}
+		} else {
+			if tag != ' ' {
+				tagStr := fmt.Sprintf(optionToFmtstr(gOpts.tagfmt), string(tag))
+				win.print(ui.screen, lnwidth+1, i, tcell.StyleDefault, tagStr)
+			}
 
-		tag, ok := context.tags[path]
-		if ok {
-			if i == dir.pos {
-				win.print(ui.screen, lnwidth+1, i, st, fmt.Sprintf(cursorescapefmt, tag))
-			} else {
-				win.print(ui.screen, lnwidth+1, i, tcell.StyleDefault, fmt.Sprintf(optionToFmtstr(gOpts.tagfmt), tag))
+			if len(icon) > 0 {
+				iconStyle := st
+				if iconDef.hasStyle {
+					iconStyle = iconDef.style
+				}
+				win.print(ui.screen, lnwidth+2, i, iconStyle, string(icon))
 			}
+
+			win.print(ui.screen, lnwidth+2+runeSliceWidth(icon), i, st, string(filename))
 		}
 	}
 }


Test patch: