Handle status bar spanning multiple lines (relevant for the Tmux network sim)
This commit is contained in:
parent
ef29e11976
commit
a620c83916
|
@ -87,20 +87,23 @@ proc render*(s: var StatusBarView) =
|
|||
let
|
||||
termWidth = terminalWidth()
|
||||
allCellsWidth = s.layout.cellsLeft.width + s.layout.cellsRight.width
|
||||
centerPadding = max(0, termWidth - allCellsWidth)
|
||||
|
||||
if allCellsWidth > 0:
|
||||
stdout.setBackgroundColor backgroundColor
|
||||
stdout.setForegroundColor foregroundColor
|
||||
renderCells(s.layout.cellsLeft, sepLeft)
|
||||
stdout.write spaces(centerPadding)
|
||||
if termWidth > allCellsWidth:
|
||||
stdout.write spaces(termWidth - allCellsWidth)
|
||||
s.consumedLines = 1
|
||||
else:
|
||||
stdout.write spaces(max(0, termWidth - s.layout.cellsLeft.width)), "\p"
|
||||
s.consumedLines = 2
|
||||
renderCells(s.layout.cellsRight, sepRight)
|
||||
stdout.resetAttributes
|
||||
stdout.flushFile
|
||||
|
||||
s.consumedLines = 1
|
||||
|
||||
proc erase*(s: var StatusBarView) =
|
||||
# cursorUp()
|
||||
for i in 1 ..< s.consumedLines: cursorUp()
|
||||
for i in 0 ..< s.consumedLines: eraseLine()
|
||||
s.consumedLines = 0
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1756f7b41f738df1e5775ede635cd9a1e0fcd990
|
||||
Subproject commit 9b40b662872274975f22fd20dab321fd434017c6
|
Loading…
Reference in New Issue