-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Hi folks 👋🏼
Background
I have recently implemented automatic color detection in delta as part of dandavison/delta#1615.
This involves sending an escape sequence (OSC 10
/ OSC 11
) to the terminal and waiting for a response.
Delta uses the terminal-colorsaurus
library for this.
There are a couple of mechanisms in place to detect terminals that don't support this escape sequence to prevent waiting forever. Quoting myself from dandavison/delta#1664 (comment):
From what I can tell lazygit runs git (and delta) inside a PTY. This PTY however does not respond to queries (such as OSC 10
or DA1
). It also does not identify itself via an environment variable such as TERM
or similar means.
For delta this currently means that we hit the timeout which we are trying to prevent as it is the last resort mechanism.
Feature Request
Would you be open to changing lazygit's PTY to identify itself somehow?
My preferred mechanism would be setting the environment variable TERM=dumb
2 since terminal-colorsaurus
(the library that delta uses) already detects this and other libraries / applications do too.
From some preliminary testing git still starts the pager when TERM=dumb
which seems to be the primary reason for using a PTY in the first place.
Footnotes
-
Colorsaurus sends two escape sequences: OSC 11 (the actual color querying sequence) followed by DA1 (which is supported by almost all terminals out there). Since terminals answer in the same order as the sequences were received we know that if we receive the answer to DA1 then the terminal does not support OSC 11 and can bail out early and avoid a long timeout. ↩
-
It might make sense in that case to also clear out
TERM_PROGRAM
andTERM_PROGRAM_VERSION
if they exist. ↩