fix: highlight additional open sessions green

This commit is contained in:
Daylin Morgan 2023-10-02 12:17:21 -05:00
parent 6e31c14f7d
commit bd7fe44ce2
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -115,20 +115,24 @@ proc clip(s: string): string =
s[0..^maxWidth] s[0..^maxWidth]
else: s else: s
proc highlight(p: Project): string =
if p.location == "": "green"
elif p.open: "yellow"
else: "default"
proc addProject(b: var Buffer, project: Project, selected: bool) = proc addProject(b: var Buffer, project: Project, selected: bool) =
let let
name = project.name.clip name = project.name.clip
input = state.input.clip input = state.input.clip
projectColor = if project.open: "yellow" else: "default"
cur = (if selected: "> " else: " ") cur = (if selected: "> " else: " ")
if project.matched: if project.matched:
var displayName = $input.bb("red") var displayName = $input.bb("red")
if input.len < name.len: if input.len < name.len:
displayName.add $name[input.len..^1].bb(projectColor) displayName.add $name[input.len..^1].bb(project.highlight)
b.addLine(cur & $displayName) b.addLine(cur & $displayName)
else: else:
b.addLine(cur & $name.bb(projectColor)) b.addLine(cur & $name.bb(project.highlight))
proc addProjectCount(b: var Buffer) = proc addProjectCount(b: var Buffer) =
let let