Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

Flickering in ghostty (or other termials that render as fast as possible) #13

Description

@Syphdias

I am currently in the closed beta for ghostty (opening up planed for the end of this year afaik).

This terminal renders everything it gets as fast as possible which leads to flickering ghostty-org/ghostty#2054. There is a way to prevent this by implementing the Synchronized Output Spec.

There would be three steps to implementing it, I am just not sure where.

  1. Check if the terminal supports the Sync Protocol by sending CSI ? 2026 $ p and receiving CSI ? 2026 ; 2 $ y (or at least not CSI ? 2026 ; 0 $ y)
  2. Before redrawing the UI, send BSU (CSI ? 2026 h)
  3. After redrawing the UI, send ESU (CSI ? 2026 l)

I think this should do the trick for setting BSU/ESU for example:

fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
BSU = b'\x1b[?2026h'

tty.setraw(fd)
os.write(fd, BSU)  # or ESU
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)

Not sure where to use stdin or stdout and where that would be in the code.

Also for detecting if the feature is available you need to get the response from stdin.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions