MCPcopy Create free account
hub / github.com/charmbracelet/bubbletea / shouldQuerySynchronizedOutput

Function shouldQuerySynchronizedOutput

tea.go:1039–1053  ·  view source on GitHub ↗

shouldQuerySynchronizedOutput determines whether the terminal should be queried for various capabilities. This function checks for terminals that are known to support mode 2026, while excluding SSH sessions which may be unreliable, unless it's a known-good terminal like Windows Terminal. The funct

(environ uv.Environ)

Source from the content-addressed store, hash-verified

1037// - Terminals with TERM_PROGRAM set (except Apple Terminal) and not in SSH sessions
1038// - Specific terminal types: ghostty, wezterm, alacritty, kitty, rio
1039func shouldQuerySynchronizedOutput(environ uv.Environ) bool {
1040 termType := environ.Getenv("TERM")
1041 termProg, okTermProg := environ.LookupEnv("TERM_PROGRAM")
1042 _, okSSHTTY := environ.LookupEnv("SSH_TTY")
1043 _, okWTSession := environ.LookupEnv("WT_SESSION")
1044
1045 return (!okTermProg && !okSSHTTY) ||
1046 okWTSession ||
1047 (okTermProg && !strings.Contains(termProg, "Apple") && !okSSHTTY) ||
1048 strings.Contains(termType, "ghostty") ||
1049 strings.Contains(termType, "wezterm") ||
1050 strings.Contains(termType, "alacritty") ||
1051 strings.Contains(termType, "kitty") ||
1052 strings.Contains(termType, "rio")
1053}
1054
1055// Run initializes the program and runs its event loops, blocking until it gets
1056// terminated by either [Program.Quit], [Program.Kill], or its signal handler.

Callers 1

RunMethod · 0.85

Calls 2

GetenvMethod · 0.80
LookupEnvMethod · 0.80

Tested by

no test coverage detected