From 93631690981d7e80f0a53a630d2cddd2a9ed9bed Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 11 Jun 2020 16:12:20 +0300 Subject: [PATCH] Cosmetic improvement for the statusbar --- beacon_chain/statusbar.nim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/beacon_chain/statusbar.nim b/beacon_chain/statusbar.nim index 213b15da4..d9a77c0ee 100644 --- a/beacon_chain/statusbar.nim +++ b/beacon_chain/statusbar.nim @@ -75,11 +75,14 @@ func width(cells: seq[StatusBarCell]): int = proc renderCells(cells: seq[StatusBarCell], sep: string) = for i, cell in cells: - if i > 0: stdout.write sep + stdout.setBackgroundColor backgroundColor + stdout.setForegroundColor foregroundColor stdout.setStyle {styleDim} + if i > 0: stdout.write sep stdout.write " ", cell.label, ": " stdout.setStyle {styleBright} stdout.write cell.content, " " + stdout.resetAttributes() proc render*(s: var StatusBarView) = doAssert s.consumedLines == 0 @@ -89,9 +92,8 @@ proc render*(s: var StatusBarView) = allCellsWidth = s.layout.cellsLeft.width + s.layout.cellsRight.width if allCellsWidth > 0: - stdout.setBackgroundColor backgroundColor - stdout.setForegroundColor foregroundColor renderCells(s.layout.cellsLeft, sepLeft) + stdout.setBackgroundColor backgroundColor if termWidth > allCellsWidth: stdout.write spaces(termWidth - allCellsWidth) s.consumedLines = 1 @@ -99,7 +101,6 @@ proc render*(s: var StatusBarView) = stdout.write spaces(max(0, termWidth - s.layout.cellsLeft.width)), "\p" s.consumedLines = 2 renderCells(s.layout.cellsRight, sepRight) - stdout.resetAttributes stdout.flushFile proc erase*(s: var StatusBarView) =