@@ -238,15 +238,17 @@ static void terminfo_start(UI *ui)
238
238
const char * vte_version_env = os_getenv ("VTE_VERSION" );
239
239
long vtev = vte_version_env ? strtol (vte_version_env , NULL , 10 ) : 0 ;
240
240
bool iterm_env = termprg && strstr (termprg , "iTerm.app" );
241
+ bool nsterm = (termprg && strstr (termprg , "Apple_Terminal" ))
242
+ || terminfo_is_term_family (term , "nsterm" );
241
243
bool konsole = terminfo_is_term_family (term , "konsole" )
242
244
|| os_getenv ("KONSOLE_PROFILE_NAME" )
243
245
|| os_getenv ("KONSOLE_DBUS_SESSION" );
244
246
const char * konsolev_env = os_getenv ("KONSOLE_VERSION" );
245
247
long konsolev = konsolev_env ? strtol (konsolev_env , NULL , 10 )
246
248
: (konsole ? 1 : 0 );
247
249
248
- patch_terminfo_bugs (data , term , colorterm , vtev , konsolev , iterm_env );
249
- augment_terminfo (data , term , colorterm , vtev , konsolev , iterm_env );
250
+ patch_terminfo_bugs (data , term , colorterm , vtev , konsolev , iterm_env , nsterm );
251
+ augment_terminfo (data , term , colorterm , vtev , konsolev , iterm_env , nsterm );
250
252
data -> can_change_scroll_region =
251
253
!!unibi_get_str (data -> ut , unibi_change_scroll_region );
252
254
data -> can_set_lr_margin =
@@ -1487,7 +1489,7 @@ static int unibi_find_ext_bool(unibi_term *ut, const char *name)
1487
1489
/// and several terminal emulators falsely announce incorrect terminal types.
1488
1490
static void patch_terminfo_bugs (TUIData * data , const char * term ,
1489
1491
const char * colorterm , long vte_version ,
1490
- long konsolev , bool iterm_env )
1492
+ long konsolev , bool iterm_env , bool nsterm )
1491
1493
{
1492
1494
unibi_term * ut = data -> ut ;
1493
1495
const char * xterm_version = os_getenv ("XTERM_VERSION" );
@@ -1496,7 +1498,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
1496
1498
#endif
1497
1499
bool xterm = terminfo_is_term_family (term , "xterm" )
1498
1500
// Treat Terminal.app as generic xterm-like, for now.
1499
- || terminfo_is_term_family ( term , " nsterm" ) ;
1501
+ || nsterm ;
1500
1502
bool kitty = terminfo_is_term_family (term , "xterm-kitty" );
1501
1503
bool linuxvt = terminfo_is_term_family (term , "linux" );
1502
1504
bool bsdvt = terminfo_is_bsd_console (term );
@@ -1515,7 +1517,6 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
1515
1517
bool alacritty = terminfo_is_term_family (term , "alacritty" );
1516
1518
// None of the following work over SSH; see :help TERM .
1517
1519
bool iterm_pretending_xterm = xterm && iterm_env ;
1518
- bool konsole_pretending_xterm = xterm && konsolev ;
1519
1520
bool gnome_pretending_xterm = xterm && colorterm
1520
1521
&& strstr (colorterm , "gnome-terminal" );
1521
1522
bool mate_pretending_xterm = xterm && colorterm
@@ -1569,27 +1570,19 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
1569
1570
// claim to be xterm. Or they would mimic xterm properly enough to be
1570
1571
// treatable as xterm.
1571
1572
1572
- // 2017-04 terminfo.src lacks these. genuine Xterm has them, as have
1573
- // the false claimants.
1573
+ // 2017-04 terminfo.src lacks these. Xterm-likes have them.
1574
1574
unibi_set_if_empty (ut , unibi_to_status_line , "\x1b]0;" );
1575
1575
unibi_set_if_empty (ut , unibi_from_status_line , "\x07" );
1576
1576
unibi_set_if_empty (ut , unibi_set_tb_margin , "\x1b[%i%p1%d;%p2%dr" );
1577
+ unibi_set_if_empty (ut , unibi_enter_italics_mode , "\x1b[3m" );
1578
+ unibi_set_if_empty (ut , unibi_exit_italics_mode , "\x1b[23m" );
1577
1579
1578
1580
if (true_xterm ) {
1579
1581
// 2017-04 terminfo.src lacks these. genuine Xterm has them.
1580
1582
unibi_set_if_empty (ut , unibi_set_lr_margin , "\x1b[%i%p1%d;%p2%ds" );
1581
1583
unibi_set_if_empty (ut , unibi_set_left_margin_parm , "\x1b[%i%p1%ds" );
1582
1584
unibi_set_if_empty (ut , unibi_set_right_margin_parm , "\x1b[%i;%p2%ds" );
1583
1585
}
1584
- if (true_xterm
1585
- || iterm_pretending_xterm
1586
- || gnome_pretending_xterm
1587
- || konsole_pretending_xterm ) {
1588
- // Apple's outdated copy of terminfo.src for MacOS lacks these.
1589
- // genuine Xterm and three false claimants have them.
1590
- unibi_set_if_empty (ut , unibi_enter_italics_mode , "\x1b[3m" );
1591
- unibi_set_if_empty (ut , unibi_exit_italics_mode , "\x1b[23m" );
1592
- }
1593
1586
} else if (rxvt ) {
1594
1587
// 2017-04 terminfo.src lacks these. Unicode rxvt has them.
1595
1588
unibi_set_if_empty (ut , unibi_enter_italics_mode , "\x1b[3m" );
@@ -1606,11 +1599,12 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
1606
1599
} else if (tmux ) {
1607
1600
unibi_set_if_empty (ut , unibi_to_status_line , "\x1b_" );
1608
1601
unibi_set_if_empty (ut , unibi_from_status_line , "\x1b\\" );
1602
+ unibi_set_if_empty (ut , unibi_enter_italics_mode , "\x1b[3m" );
1603
+ unibi_set_if_empty (ut , unibi_exit_italics_mode , "\x1b[23m" );
1609
1604
} else if (terminfo_is_term_family (term , "interix" )) {
1610
1605
// 2017-04 terminfo.src lacks this.
1611
1606
unibi_set_if_empty (ut , unibi_carriage_return , "\x0d" );
1612
1607
} else if (linuxvt ) {
1613
- // Apple's outdated copy of terminfo.src for MacOS lacks these.
1614
1608
unibi_set_if_empty (ut , unibi_parm_up_cursor , "\x1b[%p1%dA" );
1615
1609
unibi_set_if_empty (ut , unibi_parm_down_cursor , "\x1b[%p1%dB" );
1616
1610
unibi_set_if_empty (ut , unibi_parm_right_cursor , "\x1b[%p1%dC" );
@@ -1775,12 +1769,12 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
1775
1769
/// capabilities.
1776
1770
static void augment_terminfo (TUIData * data , const char * term ,
1777
1771
const char * colorterm , long vte_version ,
1778
- long konsolev , bool iterm_env )
1772
+ long konsolev , bool iterm_env , bool nsterm )
1779
1773
{
1780
1774
unibi_term * ut = data -> ut ;
1781
1775
bool xterm = terminfo_is_term_family (term , "xterm" )
1782
1776
// Treat Terminal.app as generic xterm-like, for now.
1783
- || terminfo_is_term_family ( term , " nsterm" ) ;
1777
+ || nsterm ;
1784
1778
bool bsdvt = terminfo_is_bsd_console (term );
1785
1779
bool dtterm = terminfo_is_term_family (term , "dtterm" );
1786
1780
bool rxvt = terminfo_is_term_family (term , "rxvt" );
0 commit comments