@@ -177,19 +177,41 @@ sub terminal-env-detect() is export {
177
177
$ terminal = ' tmux' ;
178
178
$ version = % * ENV <TERM_PROGRAM_VERSION >;
179
179
180
- # XXXX: Limited by symbol-set of underlying terminal emulator too
181
- $ symbol-set = symbol-set(' Full' ) if $ has-utf8 ;
182
-
183
- # XXXX: Detection of underlying terminal emulator to AND with these?
184
- $ italic = True ;
185
- $ emoji-text = True ;
186
- $ emoji-color = True ;
187
- $ emoji-skin = True ;
188
- $ emoji-iso = True ;
180
+ # tmux breaks these, regardless of underlying terminal
181
+ $ color24bit = False ;
189
182
$ emoji-reg = False ;
190
183
$ emoji-zwj = False ;
184
+
185
+ # Try to recurse to detect underlying terminal's capabilities
186
+ temp % * ENV <TERM > = $ term eq ' tmux-256color' ?? ' xterm-256color' !! ' xterm' ;
187
+ my ($ under-caps , $ under-terminal , $ under-version ) = terminal-env-detect;
188
+
189
+ my $ caps = $ under-caps . clone (: $ color24bit , : $ emoji-reg , : $ emoji-zwj );
190
+ $ terminal ~ = ' on ' ~ $ under-terminal ;
191
+ $ terminal ~ = ' version ' ~ $ under-version if $ under-version ;
192
+
193
+ return ($ caps , $ terminal , $ version );
194
+ }
195
+ elsif ? $ term . starts-with (' screen' ) {
196
+ $ terminal = ' screen' ;
197
+
198
+ # Screen breaks these, regardless of underlying terminal
199
+ $ italic = False ;
200
+ $ color24bit = False ;
201
+
202
+ # Try to recurse to detect underlying terminal's capabilities
203
+ if $ term ~~ /^ 'screen.' (.+ ) $ / {
204
+ temp % * ENV <TERM > = ~ $0 ;
205
+ my ($ under-caps , $ under-terminal , $ under-version ) = terminal-env-detect;
206
+
207
+ my $ caps = $ under-caps . clone (: $ italic , : $ color24bit );
208
+ $ terminal ~ = ' on ' ~ $ under-terminal ;
209
+ $ terminal ~ = ' version ' ~ $ under-version if $ under-version ;
210
+
211
+ return ($ caps , $ terminal , $ version );
212
+ }
191
213
}
192
- elsif ? $ term . starts-with (' screen ' | ' vt220' | ' vt420' )
214
+ elsif ? $ term . starts-with (' vt220' | ' vt420' )
193
215
|| ? $ term . lc . contains (' color' | ' ansi' | ' cygwin' | ' linux' ) {
194
216
$ terminal = $ term ;
195
217
$ color3bit = True ;
0 commit comments