From bd7fe44ce2f78bae78d4a5aa7d9806110fa23fbb Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Mon, 2 Oct 2023 12:17:21 -0500 Subject: [PATCH] fix: highlight additional open sessions green --- src/selector.nim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/selector.nim b/src/selector.nim index 25a114d..c373ae8 100644 --- a/src/selector.nim +++ b/src/selector.nim @@ -115,20 +115,24 @@ proc clip(s: string): string = s[0..^maxWidth] 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) = let name = project.name.clip input = state.input.clip - projectColor = if project.open: "yellow" else: "default" cur = (if selected: "> " else: " ") if project.matched: var displayName = $input.bb("red") 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) else: - b.addLine(cur & $name.bb(projectColor)) + b.addLine(cur & $name.bb(project.highlight)) proc addProjectCount(b: var Buffer) = let