mirror of
https://gitee.com/zhangsken/aliyunpan.git
synced 2026-10-16 10:29:42 +08:00
fix the issue that -ui print output flickering
This commit is contained in:
@@ -343,10 +343,15 @@ func (db *DashboardPanel) render() {
|
||||
builder.WriteString(renderBox(headerLines, width))
|
||||
builder.WriteString(renderTitledBox("ActiveDownloads", activeLines, width))
|
||||
builder.WriteString(renderTitledBox("History", historyBody, width))
|
||||
|
||||
content := builder.String()
|
||||
fmt.Fprint(db.out, "\x1b[H\x1b[2J") // 清屏操作
|
||||
fmt.Fprint(db.out, content)
|
||||
|
||||
// 使用双缓冲技术
|
||||
var buf strings.Builder
|
||||
// 构建完整内容
|
||||
buf.WriteString("\x1b[H\x1b[2J") // 清屏操作
|
||||
buf.WriteString(content)
|
||||
// 一次性输出
|
||||
fmt.Fprint(db.out, buf.String())
|
||||
}
|
||||
|
||||
type dashboardSnapshot struct {
|
||||
|
||||
Reference in New Issue
Block a user