mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 7.4.305
Problem: Making 'ttymouse' empty after the xterm version was requested causes problems. (Elijah Griffin) Solution: Do not check for DEC mouse sequences when the xterm version was requested. Also don't request the xterm version when DEC mouse was enabled.
This commit is contained in:
@@ -1333,6 +1333,9 @@ EXTERN HWND clientWindow INIT(= 0);
|
|||||||
#if defined(UNIX) || defined(VMS)
|
#if defined(UNIX) || defined(VMS)
|
||||||
EXTERN int term_is_xterm INIT(= FALSE); /* xterm-like 'term' */
|
EXTERN int term_is_xterm INIT(= FALSE); /* xterm-like 'term' */
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(UNIX)
|
||||||
|
EXTERN int xterm_conflict_mouse INIT(= FALSE);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef BACKSLASH_IN_FILENAME
|
#ifdef BACKSLASH_IN_FILENAME
|
||||||
EXTERN char psepc INIT(= '\\'); /* normal path separator character */
|
EXTERN char psepc INIT(= '\\'); /* normal path separator character */
|
||||||
|
@@ -3667,6 +3667,8 @@ mch_setmouse(on)
|
|||||||
void
|
void
|
||||||
check_mouse_termcode()
|
check_mouse_termcode()
|
||||||
{
|
{
|
||||||
|
xterm_conflict_mouse = FALSE;
|
||||||
|
|
||||||
# ifdef FEAT_MOUSE_XTERM
|
# ifdef FEAT_MOUSE_XTERM
|
||||||
if (use_xterm_mouse()
|
if (use_xterm_mouse()
|
||||||
# ifdef FEAT_MOUSE_URXVT
|
# ifdef FEAT_MOUSE_URXVT
|
||||||
@@ -3711,7 +3713,7 @@ check_mouse_termcode()
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef FEAT_MOUSE_JSB
|
# ifdef FEAT_MOUSE_JSB
|
||||||
/* conflicts with xterm mouse: "\033[" and "\033[M" ??? */
|
/* There is no conflict, but it was disabled for xterm before. */
|
||||||
if (!use_xterm_mouse()
|
if (!use_xterm_mouse()
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
&& !gui.in_use
|
&& !gui.in_use
|
||||||
@@ -3738,32 +3740,40 @@ check_mouse_termcode()
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef FEAT_MOUSE_DEC
|
# ifdef FEAT_MOUSE_DEC
|
||||||
/* conflicts with xterm mouse: "\033[" and "\033[M" */
|
/* Conflicts with xterm mouse: "\033[" and "\033[M".
|
||||||
if (!use_xterm_mouse()
|
* Also conflicts with the xterm termresponse, skip this if it was
|
||||||
|
* requested already. */
|
||||||
|
if (!use_xterm_mouse() && !did_request_esc_sequence()
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
&& !gui.in_use
|
&& !gui.in_use
|
||||||
# endif
|
# endif
|
||||||
)
|
)
|
||||||
|
{
|
||||||
set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME)
|
set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME)
|
||||||
? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "[")));
|
? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "[")));
|
||||||
|
xterm_conflict_mouse = TRUE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
del_mouse_termcode(KS_DEC_MOUSE);
|
del_mouse_termcode(KS_DEC_MOUSE);
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_MOUSE_PTERM
|
# ifdef FEAT_MOUSE_PTERM
|
||||||
/* same as the dec mouse */
|
/* same as the dec mouse */
|
||||||
if (!use_xterm_mouse()
|
if (!use_xterm_mouse() && !did_request_esc_sequence()
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
&& !gui.in_use
|
&& !gui.in_use
|
||||||
# endif
|
# endif
|
||||||
)
|
)
|
||||||
|
{
|
||||||
set_mouse_termcode(KS_PTERM_MOUSE,
|
set_mouse_termcode(KS_PTERM_MOUSE,
|
||||||
(char_u *) IF_EB("\033[", ESC_STR "["));
|
(char_u *) IF_EB("\033[", ESC_STR "["));
|
||||||
|
xterm_conflict_mouse = TRUE;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
del_mouse_termcode(KS_PTERM_MOUSE);
|
del_mouse_termcode(KS_PTERM_MOUSE);
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_MOUSE_URXVT
|
# ifdef FEAT_MOUSE_URXVT
|
||||||
/* same as the dec mouse */
|
/* same as the dec mouse */
|
||||||
if (use_xterm_mouse() == 3
|
if (use_xterm_mouse() == 3 && !did_request_esc_sequence()
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
&& !gui.in_use
|
&& !gui.in_use
|
||||||
# endif
|
# endif
|
||||||
@@ -3778,6 +3788,7 @@ check_mouse_termcode()
|
|||||||
mch_setmouse(FALSE);
|
mch_setmouse(FALSE);
|
||||||
setmouse();
|
setmouse();
|
||||||
}
|
}
|
||||||
|
xterm_conflict_mouse = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
del_mouse_termcode(KS_URXVT_MOUSE);
|
del_mouse_termcode(KS_URXVT_MOUSE);
|
||||||
|
@@ -34,6 +34,7 @@ void set_shellsize __ARGS((int width, int height, int mustset));
|
|||||||
void settmode __ARGS((int tmode));
|
void settmode __ARGS((int tmode));
|
||||||
void starttermcap __ARGS((void));
|
void starttermcap __ARGS((void));
|
||||||
void stoptermcap __ARGS((void));
|
void stoptermcap __ARGS((void));
|
||||||
|
int did_request_esc_sequence __ARGS((void));
|
||||||
void may_req_termresponse __ARGS((void));
|
void may_req_termresponse __ARGS((void));
|
||||||
void may_req_ambiguous_char_width __ARGS((void));
|
void may_req_ambiguous_char_width __ARGS((void));
|
||||||
int swapping_screen __ARGS((void));
|
int swapping_screen __ARGS((void));
|
||||||
|
37
src/term.c
37
src/term.c
@@ -153,6 +153,11 @@ char *UP, *BC, PC;
|
|||||||
static char_u *vim_tgetstr __ARGS((char *s, char_u **pp));
|
static char_u *vim_tgetstr __ARGS((char *s, char_u **pp));
|
||||||
#endif /* HAVE_TGETENT */
|
#endif /* HAVE_TGETENT */
|
||||||
|
|
||||||
|
#if defined(FEAT_TERMRESPONSE)
|
||||||
|
static int xt_index_in = 0;
|
||||||
|
static int xt_index_out = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
static int detected_8bit = FALSE; /* detected 8-bit terminal */
|
static int detected_8bit = FALSE; /* detected 8-bit terminal */
|
||||||
|
|
||||||
static struct builtin_term builtin_termcaps[] =
|
static struct builtin_term builtin_termcaps[] =
|
||||||
@@ -3259,7 +3264,7 @@ starttermcap()
|
|||||||
may_req_termresponse();
|
may_req_termresponse();
|
||||||
/* Immediately check for a response. If t_Co changes, we don't
|
/* Immediately check for a response. If t_Co changes, we don't
|
||||||
* want to redraw with wrong colors first. */
|
* want to redraw with wrong colors first. */
|
||||||
if (crv_status != CRV_GET)
|
if (crv_status == CRV_SENT)
|
||||||
check_for_codes_from_term();
|
check_for_codes_from_term();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -3306,6 +3311,30 @@ stoptermcap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(UNIX) || defined(PROTO)
|
||||||
|
/*
|
||||||
|
* Return TRUE when the xterm version was requested or anything else that
|
||||||
|
* would send an ESC sequence back to Vim.
|
||||||
|
* If not sent yet, prevent it from being sent soon.
|
||||||
|
* Used to check whether it is OK to enable checking for DEC mouse codes,
|
||||||
|
* which conflict with may xterm ESC sequences.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
did_request_esc_sequence()
|
||||||
|
{
|
||||||
|
if (crv_status == CRV_GET)
|
||||||
|
crv_status = 0;
|
||||||
|
if (u7_status == U7_GET)
|
||||||
|
u7_status = 0;
|
||||||
|
return crv_status == CRV_SENT || u7_status == U7_SENT
|
||||||
|
# if defined(FEAT_TERMRESPONSE)
|
||||||
|
|| xt_index_out > xt_index_in
|
||||||
|
# endif
|
||||||
|
;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(FEAT_TERMRESPONSE) || defined(PROTO)
|
#if defined(FEAT_TERMRESPONSE) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Request version string (for xterm) when needed.
|
* Request version string (for xterm) when needed.
|
||||||
@@ -3319,6 +3348,8 @@ stoptermcap()
|
|||||||
* Insert mode.
|
* Insert mode.
|
||||||
* On Unix only do it when both output and input are a tty (avoid writing
|
* On Unix only do it when both output and input are a tty (avoid writing
|
||||||
* request to terminal while reading from a file).
|
* request to terminal while reading from a file).
|
||||||
|
* Do not do this when a mouse is being detected that starts with the same ESC
|
||||||
|
* sequence as the termresponse.
|
||||||
* The result is caught in check_termcode().
|
* The result is caught in check_termcode().
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@@ -3332,6 +3363,7 @@ may_req_termresponse()
|
|||||||
# ifdef UNIX
|
# ifdef UNIX
|
||||||
&& isatty(1)
|
&& isatty(1)
|
||||||
&& isatty(read_cmd_fd)
|
&& isatty(read_cmd_fd)
|
||||||
|
&& !xterm_conflict_mouse
|
||||||
# endif
|
# endif
|
||||||
&& *T_CRV != NUL)
|
&& *T_CRV != NUL)
|
||||||
{
|
{
|
||||||
@@ -5714,9 +5746,6 @@ show_one_termcode(name, code, printit)
|
|||||||
* termcap codes from the terminal itself.
|
* termcap codes from the terminal itself.
|
||||||
* We get them one by one to avoid a very long response string.
|
* We get them one by one to avoid a very long response string.
|
||||||
*/
|
*/
|
||||||
static int xt_index_in = 0;
|
|
||||||
static int xt_index_out = 0;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
req_codes_from_term()
|
req_codes_from_term()
|
||||||
{
|
{
|
||||||
|
@@ -734,6 +734,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 */
|
||||||
|
/**/
|
||||||
|
305,
|
||||||
/**/
|
/**/
|
||||||
304,
|
304,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user