( isCollapsed bool, hasUnstagedChanges bool, hasStagedChanges bool, treeDepth int, visualDepth int, showNumstat, showFileIcons bool, submoduleConfigs []*models.SubmoduleConfig, node *filetree.Node[models.File], customIconsConfig *config.CustomIconsConfig, showRootItem bool, )
| 110 | } |
| 111 | |
| 112 | func getFileLine( |
| 113 | isCollapsed bool, |
| 114 | hasUnstagedChanges bool, |
| 115 | hasStagedChanges bool, |
| 116 | treeDepth int, |
| 117 | visualDepth int, |
| 118 | showNumstat, |
| 119 | showFileIcons bool, |
| 120 | submoduleConfigs []*models.SubmoduleConfig, |
| 121 | node *filetree.Node[models.File], |
| 122 | customIconsConfig *config.CustomIconsConfig, |
| 123 | showRootItem bool, |
| 124 | ) string { |
| 125 | name := fileNameAtDepth(node, treeDepth, showRootItem) |
| 126 | output := "" |
| 127 | |
| 128 | var nameColor style.TextStyle |
| 129 | |
| 130 | file := node.File |
| 131 | |
| 132 | indentation := strings.Repeat(" ", visualDepth) |
| 133 | |
| 134 | if hasStagedChanges && !hasUnstagedChanges { |
| 135 | nameColor = style.FgGreen |
| 136 | } else if hasStagedChanges { |
| 137 | nameColor = style.FgYellow |
| 138 | } else { |
| 139 | nameColor = theme.DefaultTextColor |
| 140 | } |
| 141 | |
| 142 | if file == nil { |
| 143 | output += indentation + "" |
| 144 | arrow := EXPANDED_ARROW |
| 145 | if isCollapsed { |
| 146 | arrow = COLLAPSED_ARROW |
| 147 | } |
| 148 | |
| 149 | arrowStyle := nameColor |
| 150 | |
| 151 | output += arrowStyle.Sprint(arrow) + " " |
| 152 | } else { |
| 153 | // Sprinting the space at the end in the specific style is for the sake of |
| 154 | // when a reverse style is used in the theme, which looks ugly if you just |
| 155 | // use the default style |
| 156 | output += indentation + formatFileStatus(file, nameColor) + nameColor.Sprint(" ") |
| 157 | } |
| 158 | |
| 159 | isSubmodule := file != nil && file.IsSubmodule(submoduleConfigs) |
| 160 | isLinkedWorktree := file != nil && file.IsWorktree |
| 161 | isDirectory := file == nil |
| 162 | |
| 163 | if showFileIcons { |
| 164 | icon := icons.IconForFile(name, isSubmodule, isLinkedWorktree, isDirectory, customIconsConfig) |
| 165 | paint := color.HEX(icon.Color, false) |
| 166 | output += paint.Sprint(icon.Icon) + nameColor.Sprint(" ") |
| 167 | } |
| 168 | |
| 169 | output += nameColor.Sprint(utils.EscapeSpecialChars(name)) |
no test coverage detected