mirror of
https://github.com/restic/restic.git
synced 2025-10-27 14:28:54 +00:00
Rework termstatus
This now keeps the cursor at the first column of the first status line so that messages printed to stdout or stderr by some other part of the progarm will still be visible. The message will overwrite the status lines, but those are easily reprinted on the next status update.
This commit is contained in:
@@ -10,10 +10,15 @@ import (
|
||||
isatty "github.com/mattn/go-isatty"
|
||||
)
|
||||
|
||||
// clearLines will clear the current line and the n lines above. Afterwards the
|
||||
// cursor is positioned at the start of the first cleared line.
|
||||
func clearLines(wr io.Writer, fd uintptr) clearLinesFunc {
|
||||
return posixClearLines
|
||||
// clearCurrentLine removes all characters from the current line and resets the
|
||||
// cursor position to the first column.
|
||||
func clearCurrentLine(wr io.Writer, fd uintptr) func(io.Writer, uintptr) {
|
||||
return posixClearCurrentLine
|
||||
}
|
||||
|
||||
// moveCursorUp moves the cursor to the line n lines above the current one.
|
||||
func moveCursorUp(wr io.Writer, fd uintptr) func(io.Writer, uintptr, int) {
|
||||
return posixMoveCursorUp
|
||||
}
|
||||
|
||||
// canUpdateStatus returns true if status lines can be printed, the process
|
||||
|
||||
Reference in New Issue
Block a user