@@ -54,7 +54,6 @@ fn terminal_quirk_from_env_eager() -> TerminalQuirks {
54
54
// => since there's no way to know that we need to expect multiple responses
55
55
// some of them are not consumed by us and end up on the user's screen :/
56
56
Ok ( term) if term == "screen" || term. starts_with ( "screen." ) => Unsupported ,
57
- Ok ( term) if term == "rxvt-unicode" || term. starts_with ( "rxvt-unicode-" ) => Urxvt ,
58
57
Ok ( _) => None ,
59
58
}
60
59
}
@@ -63,7 +62,6 @@ fn terminal_quirk_from_env_eager() -> TerminalQuirks {
63
62
pub ( crate ) enum TerminalQuirks {
64
63
None ,
65
64
Unsupported ,
66
- Urxvt ,
67
65
}
68
66
69
67
impl TerminalQuirks {
@@ -72,17 +70,19 @@ impl TerminalQuirks {
72
70
}
73
71
74
72
pub ( crate ) fn string_terminator ( self ) -> & ' static [ u8 ] {
75
- const ST : & [ u8 ] = b"\x1b \\ " ;
73
+ // The currently released version of rxvt-unicode (urxvt) has a bug where it terminates the response with `ESC` instead of `ST` (`ESC \`).
74
+ // This causes us to run into the timeout because we get stuck waiting for a `\` that never arrives.
75
+ // Fixed by revision [1.600](http://cvs.schmorp.de/rxvt-unicode/src/command.C?revision=1.600&view=markup).
76
+ // The bug can be worked around by sending a query with `BEL` which will result in a `BEL`-terminated response.
77
+ //
78
+ // Originally, we used `BEL` only for urxvt. However, after a discussion in delta [1],
79
+ // I noticed that there are quite a few people who use urxvt with a different `TERM`
80
+ // env var (e.g. `urxvt`, `xterm`, or even `screen`) [2].
81
+ //
82
+ // [1]: https://github.com/dandavison/delta/issues/1897
83
+ // [2]: https://github.com/search?q=URxvt*termName&type=code
76
84
const BEL : u8 = 0x07 ;
77
-
78
- if let TerminalQuirks :: Urxvt = self {
79
- // The currently released version has a bug where it terminates the response with `ESC` instead of `ST`.
80
- // Fixed by revision [1.600](http://cvs.schmorp.de/rxvt-unicode/src/command.C?revision=1.600&view=markup).
81
- // The bug can be worked around by sending a query with `BEL` which will result in a `BEL`-terminated response.
82
- & [ BEL ]
83
- } else {
84
- ST
85
- }
85
+ & [ BEL ]
86
86
}
87
87
88
88
pub ( crate ) fn write_all ( self , w : & mut dyn Write , bytes : & [ u8 ] ) -> io:: Result < ( ) > {
0 commit comments