forked from aniani/vim
patch 8.0.0996: Mac: t_RS is echoed on the screne in Terminal.app
Problem: Mac: t_RS is echoed on the screne in Terminal.app. Even though $TERM is set to "xterm-256colors" it cannot handle this xterm escape sequence. Solution: Recognize Terminal.app from the termresponse and skip sending t_RS if it looks like Terminal.app.
This commit is contained in:
54
src/term.c
54
src/term.c
@@ -1360,6 +1360,9 @@ static int need_gather = FALSE; /* need to fill termleader[] */
|
|||||||
static char_u termleader[256 + 1]; /* for check_termcode() */
|
static char_u termleader[256 + 1]; /* for check_termcode() */
|
||||||
#ifdef FEAT_TERMRESPONSE
|
#ifdef FEAT_TERMRESPONSE
|
||||||
static int check_for_codes = FALSE; /* check for key code response */
|
static int check_for_codes = FALSE; /* check for key code response */
|
||||||
|
# ifdef MACOS
|
||||||
|
static int is_terminal_app = FALSE; /* recognized Terminal.app */
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct builtin_term *
|
static struct builtin_term *
|
||||||
@@ -3497,8 +3500,6 @@ may_req_ambiguous_char_width(void)
|
|||||||
void
|
void
|
||||||
may_req_bg_color(void)
|
may_req_bg_color(void)
|
||||||
{
|
{
|
||||||
int done = FALSE;
|
|
||||||
|
|
||||||
if (can_get_termresponse() && starting == 0)
|
if (can_get_termresponse() && starting == 0)
|
||||||
{
|
{
|
||||||
/* Only request background if t_RB is set and 'background' wasn't
|
/* Only request background if t_RB is set and 'background' wasn't
|
||||||
@@ -3510,27 +3511,13 @@ may_req_bg_color(void)
|
|||||||
LOG_TR("Sending BG request");
|
LOG_TR("Sending BG request");
|
||||||
out_str(T_RBG);
|
out_str(T_RBG);
|
||||||
rbg_status = STATUS_SENT;
|
rbg_status = STATUS_SENT;
|
||||||
done = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Only request the cursor shape if t_SH and t_RS are set. */
|
/* check for the characters now, otherwise they might be eaten by
|
||||||
if (rcm_status == STATUS_GET
|
* get_keystroke() */
|
||||||
&& *T_CSH != NUL
|
out_flush();
|
||||||
&& *T_CRS != NUL)
|
(void)vpeekc_nomap();
|
||||||
{
|
|
||||||
LOG_TR("Sending cursor shape request");
|
|
||||||
out_str(T_CRS);
|
|
||||||
rcm_status = STATUS_SENT;
|
|
||||||
done = TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (done)
|
|
||||||
{
|
|
||||||
/* check for the characters now, otherwise they might be eaten by
|
|
||||||
* get_keystroke() */
|
|
||||||
out_flush();
|
|
||||||
(void)vpeekc_nomap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef DEBUG_TERMRESPONSE
|
# ifdef DEBUG_TERMRESPONSE
|
||||||
@@ -4531,6 +4518,33 @@ check_termcode(
|
|||||||
if (mch_getenv((char_u *)"COLORS") == NULL)
|
if (mch_getenv((char_u *)"COLORS") == NULL)
|
||||||
may_adjust_color_count(256);
|
may_adjust_color_count(256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifdef MACOS
|
||||||
|
/* Mac Terminal.app sends 1;95;0 */
|
||||||
|
if (col == 95
|
||||||
|
&& STRNCMP(tp + extra - 2, ">1;95;0c", 9) == 0)
|
||||||
|
{
|
||||||
|
/* Terminal.app sets $TERM to "xterm-256colors",
|
||||||
|
* but it's not fully xterm compatible. */
|
||||||
|
is_terminal_app = TRUE;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Only request the cursor style if t_SH and t_RS are
|
||||||
|
* set. Not for Terminal.app, it can't handle t_RS, it
|
||||||
|
* echoes the characters to the screen. */
|
||||||
|
if (rcm_status == STATUS_GET
|
||||||
|
# ifdef MACOS
|
||||||
|
&& !is_terminal_app
|
||||||
|
# endif
|
||||||
|
&& *T_CSH != NUL
|
||||||
|
&& *T_CRS != NUL)
|
||||||
|
{
|
||||||
|
LOG_TR("Sending cursor style request");
|
||||||
|
out_str(T_CRS);
|
||||||
|
rcm_status = STATUS_SENT;
|
||||||
|
out_flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
set_vim_var_string(VV_TERMRESPONSE, tp, i + 1);
|
set_vim_var_string(VV_TERMRESPONSE, tp, i + 1);
|
||||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
996,
|
||||||
/**/
|
/**/
|
||||||
995,
|
995,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user