Skip to content

Commit 253a787

Browse files
authored
Merge pull request #397 from pluiedev/pluie/jj-krvukpsvmwss
docs: add Synchronized Output help page
2 parents d3b82df + d2664b5 commit 253a787

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

docs/help/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ we try to document as many common issues and solutions as possible.
1919
| Ghostty has slow startup or high memory usage on Linux. | [GTK Single Instance](/docs/help/gtk-single-instance) |
2020
| "Unable to acquire OpenGL context" error on Linux | [GTK OpenGL Context](/docs/help/gtk-opengl-context) |
2121
| macOS defaults to login shells | [macOS Login Shells](/docs/help/macos-login-shells) |
22+
| CLI tools like Claude Code, Docker, etc. repeatedly flash or flicker | [Synchronized Output](/docs/help/synchronized-output) |
2223

2324
## Seeking Help
2425

docs/help/synchronized-output.mdx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: Synchronized Output
3+
description: |-
4+
Command-line programs that update large swaths of the visible screen might
5+
show screen tearing on fast terminals like Ghostty, when synchronized
6+
output is not enabled.
7+
---
8+
9+
On some systems, command-line programs that frequently update large swaths of
10+
the visible screen might repeatedly flicker or exhibit severe screen tearing
11+
when using Ghostty, which does not occur with other terminal emulators.
12+
**This is usually not a bug with Ghostty, but rather a bug with the programs
13+
themselves.**
14+
15+
Often the reason behind this is that Ghostty is rendering **too quickly**,
16+
and the programs that are redrawing the screen are not updating the cells
17+
on the screen fast enough to catch up with the renderer — hence, tearing.
18+
19+
There's not much Ghostty can do here without compromising performance, and
20+
therefore we **highly encourage** users of affected programs to file issues
21+
to upstream developers with a link to the ["For developers"](#for-developers)
22+
section of this page, so that they know how to fix the underlying problem.
23+
24+
Programs known to be affected by this include:
25+
26+
- Claude Code ([#8176], [#8285])
27+
- Docker CLI ([#5493], [#5657], [#8162])
28+
- Ollama ([#4048])
29+
- Grok ([#9618])
30+
31+
[#4048]: https://github.com/ghostty-org/ghostty/discussions/4048
32+
[#5493]: https://github.com/ghostty-org/ghostty/discussions/5493
33+
[#5657]: https://github.com/ghostty-org/ghostty/discussions/5657
34+
[#8162]: https://github.com/ghostty-org/ghostty/discussions/8162
35+
[#8176]: https://github.com/ghostty-org/ghostty/discussions/8176
36+
[#8285]: https://github.com/ghostty-org/ghostty/discussions/8285
37+
[#9618]: https://github.com/ghostty-org/ghostty/discussions/9618
38+
39+
## For developers
40+
41+
If you're a developer of a CLI or TUI-based app that has this issue, you
42+
need to implement the [Synchronized Output] protocol which signals Ghostty
43+
(and other modern, performant terminal emulators) when the screen has been
44+
fully updated, and it is safe to render the next frame.
45+
46+
However, as a best practice we also recommend **only updating the cells that
47+
absolutely need to be updated**, and avoid erasing whole rows or the entirety
48+
of the active screen before updating new cells. Instead, you can reset the
49+
cursor to the part to be updated by using [Cursor Position (CUP)], update the
50+
cells, and erase the rest of the line using [Erase in Line (EL)]. This not
51+
only ameliorates the screen tearing on terminals that may not support the
52+
Synchronized Output protocol, but can also greatly increase performance by
53+
reducing needless updates and the amount of data sent to the terminal.
54+
55+
[Synchronized Output]: https://github.com/contour-terminal/vt-extensions/blob/1a9fde53d80c4a60b1be44c5a4492d86ec9f9cce/synchronized-output.md
56+
[Cursor Position (CUP)]: /docs/vt/csi/cup
57+
[Erase in Line (EL)]: /docs/vt/csi/el

docs/nav.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,11 @@
558558
"type": "link",
559559
"path": "/macos-login-shells",
560560
"title": "macOS Login Shells"
561+
},
562+
{
563+
"type": "link",
564+
"path": "/synchronized-output",
565+
"title": "Synchronized Output"
561566
}
562567
]
563568
}

0 commit comments

Comments
 (0)