Now state on the footer will be properly updated

This commit is contained in:
qowevisa 2024-03-15 18:00:11 +02:00
parent e6a11180b2
commit 0a1a7dfbcf

View File

@ -200,9 +200,10 @@ func (t *TUI) setRoutines() error {
for state := range t.stateChannel { for state := range t.stateChannel {
t.writeMu.Lock() t.writeMu.Lock()
oldRow, oldCol := t.getCursorPos() oldRow, oldCol := t.getCursorPos()
t.moveCursor(t.height, len(footerStart)+1) t.errors <- t.moveCursor(t.height, len(footerStart)+1)
t.write(state) t._clearLine()
t.moveCursor(oldRow, oldCol) t.errors <- t.write(state)
t.errors <- t.moveCursor(oldRow, oldCol)
t.writeMu.Unlock() t.writeMu.Unlock()
} }
}() }()
@ -455,6 +456,10 @@ func (t *TUI) getCursorPos() (int, int) {
return t.cursorPosRow, t.cursorPosCol return t.cursorPosRow, t.cursorPosCol
} }
func (t *TUI) _clearLine() {
t.errors <- t.write("\033[0K")
}
func (t *TUI) moveCursor(row, col int) error { func (t *TUI) moveCursor(row, col int) error {
t.sizeMutex.Lock() t.sizeMutex.Lock()
defer t.sizeMutex.Unlock() defer t.sizeMutex.Unlock()