소스 검색

cmd: eliminate flickering with synchronized output

Jeremy Schlatter 2 달 전
부모
커밋
f9c7ead160
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      progress/progress.go

+ 5 - 2
progress/progress.go

@@ -83,11 +83,14 @@ func (p *Progress) render() {
 	p.mu.Lock()
 	defer p.mu.Unlock()
 
-	// buffer the terminal update to minimize cursor flickering
-	// https://gitlab.gnome.org/GNOME/vte/-/issues/2837#note_2269501
+	// buffer output to minimize flickering on all terminals
 	p.buf.Reset()
 	defer p.buf.WriteTo(p.w)
 
+	// eliminate flickering on terminals that support synchronized output
+	fmt.Fprint(&p.buf, "\033[?2026h")
+	defer fmt.Fprint(&p.buf, "\033[?2026l")
+
 	fmt.Fprint(&p.buf, "\033[?25l")
 	defer fmt.Fprint(&p.buf, "\033[?25h")