1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Style missing worktree as red and display better error when trying to switch to them

Use a broken link icon for missing worktrees
This commit is contained in:
Joel Baranick
2022-09-02 09:35:08 -07:00
committed by Jesse Duffield
parent 9a79154d05
commit c679fd1924
10 changed files with 103 additions and 85 deletions

View File

@ -20,16 +20,22 @@ func getWorktreeDisplayStrings(w *models.Worktree) []string {
current := ""
currentColor := style.FgCyan
if w.Current {
if w.Current() {
current = " *"
currentColor = style.FgGreen
}
icon := icons.IconForWorktree(w, false)
if w.Missing() {
textStyle = style.FgRed
icon = icons.IconForWorktree(w, true)
}
res := make([]string, 0, 3)
res = append(res, currentColor.Sprint(current))
if icons.IsIconEnabled() {
res = append(res, textStyle.Sprint(icons.IconForWorktree(w)))
res = append(res, textStyle.Sprint(icon))
}
res = append(res, textStyle.Sprint(w.Name))
res = append(res, textStyle.Sprint(w.Name()))
return res
}