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:
committed by
Jesse Duffield
parent
9a79154d05
commit
c679fd1924
@ -7,14 +7,15 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
BRANCH_ICON = "\U000f062c" //
|
||||
DETACHED_HEAD_ICON = "\ue729" //
|
||||
TAG_ICON = "\uf02b" //
|
||||
COMMIT_ICON = "\U000f0718" //
|
||||
MERGE_COMMIT_ICON = "\U000f062d" //
|
||||
DEFAULT_REMOTE_ICON = "\uf02a2" //
|
||||
STASH_ICON = "\uf01c" //
|
||||
LINKED_WORKTREE_ICON = "\uf838" //
|
||||
BRANCH_ICON = "\U000f062c" //
|
||||
DETACHED_HEAD_ICON = "\ue729" //
|
||||
TAG_ICON = "\uf02b" //
|
||||
COMMIT_ICON = "\U000f0718" //
|
||||
MERGE_COMMIT_ICON = "\U000f062d" //
|
||||
DEFAULT_REMOTE_ICON = "\uf02a2" //
|
||||
STASH_ICON = "\uf01c" //
|
||||
LINKED_WORKTREE_ICON = "\uf838" //
|
||||
MISSING_LINKED_WORKTREE_ICON = "\uf839" //
|
||||
)
|
||||
|
||||
var remoteIcons = map[string]string{
|
||||
@ -70,9 +71,12 @@ func IconForStash(stash *models.StashEntry) string {
|
||||
return STASH_ICON
|
||||
}
|
||||
|
||||
func IconForWorktree(worktree *models.Worktree) string {
|
||||
if worktree.Main {
|
||||
func IconForWorktree(worktree *models.Worktree, missing bool) string {
|
||||
if worktree.Main() {
|
||||
return ""
|
||||
}
|
||||
if missing {
|
||||
return MISSING_LINKED_WORKTREE_ICON
|
||||
}
|
||||
return LINKED_WORKTREE_ICON
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user