Skip to content

Commit 01d74bb

Browse files
committed
Attempt to detect warp terminal using TERM_PROGRAM
It is a proprietary terminal that supports iTerm2. Issues: #151
1 parent a2034f5 commit 01d74bb

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/term-query.cc

+13-6
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,20 @@ TermGraphicsInfo QuerySupportedGraphicsProtocol() {
243243
// Fall through, as we still have to determine if we're in tmux
244244
}
245245

246-
// vscode doesn't provide a way to query the terminal, but can do
247-
// iterm graphics.
246+
// Some terminals with Windows heritage often don't support query of
247+
// the terminal, but are set TERM_PROGRAM
248248
const char *const term_program = getenv("TERM_PROGRAM");
249-
if (term_program && strcmp(term_program, "vscode") == 0) {
250-
result.preferred_graphics = GraphicsProtocol::kIterm2;
251-
// In case the user chooses sixel.
252-
result.sixel.known_broken_cursor_placement = true;
249+
if (term_program) {
250+
if (strcmp(term_program, "vscode") == 0) {
251+
result.preferred_graphics = GraphicsProtocol::kIterm2;
252+
// In case the user chooses sixel.
253+
result.sixel.known_broken_cursor_placement = true;
254+
}
255+
else if (strcmp(term_program, "WarpTerminal") == 0) {
256+
// At least on Mac and Linux according to #151
257+
// (Windows support unclear)
258+
result.preferred_graphics = GraphicsProtocol::kIterm2;
259+
}
253260
}
254261

255262
// Note, there is a kitty protocol way to determine if kitty is supported,

0 commit comments

Comments
 (0)