Skip to content

Commit 20091c1

Browse files
committed
patch 8.1.0566: SGR not enabled for mintty because $TERM is "xterm"
Problem: SGR not enabled for mintty because $TERM is "xterm". Solution: Detect mintty by the termresponse. (Ken Takata, closes #3667)
1 parent 10600db commit 20091c1

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/term.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4698,6 +4698,12 @@ check_termcode(
46984698
int need_flush = FALSE;
46994699
# ifdef FEAT_MOUSE_SGR
47004700
int is_iterm2 = FALSE;
4701+
int is_mintty = FALSE;
4702+
4703+
// mintty 2.9.5 sends 77;20905;0c.
4704+
// (77 is ASCII 'M' for mintty.)
4705+
if (STRNCMP(tp + extra - 3, "77;", 3) == 0)
4706+
is_mintty = TRUE;
47014707
# endif
47024708

47034709
/* if xterm version >= 141 try to get termcap codes */
@@ -4751,8 +4757,9 @@ check_termcode(
47514757
{
47524758
# ifdef FEAT_MOUSE_SGR
47534759
/* Xterm version 277 supports SGR. Also support
4754-
* Terminal.app and iTerm2. */
4755-
if (version >= 277 || is_iterm2 || is_mac_terminal)
4760+
* Terminal.app, iTerm2 and mintty. */
4761+
if (version >= 277 || is_iterm2 || is_mac_terminal
4762+
|| is_mintty)
47564763
set_option_value((char_u *)"ttym", 0L,
47574764
(char_u *)"sgr", 0);
47584765
else

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,8 @@ static char *(features[]) =
792792

793793
static int included_patches[] =
794794
{ /* Add new patch number below this line */
795+
/**/
796+
566,
795797
/**/
796798
565,
797799
/**/

0 commit comments

Comments
 (0)