mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #1150 from splinterofchaos/vim-patch-7.4.305
Vim patch 7.4.305 + Vim patch 7.4.359
This commit is contained in:
commit
0375128377
@ -1059,6 +1059,10 @@ EXTERN int typebuf_was_filled INIT(= FALSE); /* received text from client
|
||||
EXTERN int term_is_xterm INIT(= FALSE); /* xterm-like 'term' */
|
||||
#endif
|
||||
|
||||
#if defined(UNIX)
|
||||
EXTERN int xterm_conflict_mouse INIT(= FALSE);
|
||||
#endif
|
||||
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
EXTERN char psepc INIT(= '\\'); /* normal path separator character */
|
||||
EXTERN char psepcN INIT(= '/'); /* abnormal path separator character */
|
||||
|
@ -761,11 +761,11 @@ void mch_setmouse(int on)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the mouse termcode, depending on the 'term' and 'ttymouse' options.
|
||||
*/
|
||||
/// Sets the mouse termcode, depending on the 'term' and 'ttymouse' options.
|
||||
void check_mouse_termcode(void)
|
||||
{
|
||||
xterm_conflict_mouse = false;
|
||||
|
||||
if (use_xterm_mouse()
|
||||
&& use_xterm_mouse() != 3
|
||||
) {
|
||||
@ -791,29 +791,31 @@ void check_mouse_termcode(void)
|
||||
else
|
||||
del_mouse_termcode(KS_NETTERM_MOUSE);
|
||||
|
||||
/* conflicts with xterm mouse: "\033[" and "\033[M" */
|
||||
if (!use_xterm_mouse()
|
||||
)
|
||||
// Conflicts with xterm mouse: "\033[" and "\033[M".
|
||||
// Also conflicts with the xterm termresponse, skip this if it was requested
|
||||
// already.
|
||||
if (!use_xterm_mouse()) {
|
||||
set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME)
|
||||
? "\233" : "\033["));
|
||||
else
|
||||
xterm_conflict_mouse = true;
|
||||
}
|
||||
else {
|
||||
del_mouse_termcode(KS_DEC_MOUSE);
|
||||
}
|
||||
/* same as the dec mouse */
|
||||
if (use_xterm_mouse() == 3
|
||||
) {
|
||||
set_mouse_termcode(KS_URXVT_MOUSE, (char_u *)(term_is_8bit(T_NAME)
|
||||
? "\233"
|
||||
: "\033["));
|
||||
|
||||
if (use_xterm_mouse() == 3 && !did_request_esc_sequence()) {
|
||||
set_mouse_termcode(KS_URXVT_MOUSE,
|
||||
(char_u *)(term_is_8bit(T_NAME) ? "\233" : "\033["));
|
||||
if (*p_mouse != NUL) {
|
||||
mch_setmouse(FALSE);
|
||||
mch_setmouse(false);
|
||||
setmouse();
|
||||
}
|
||||
} else
|
||||
resume_get_esc_sequence();
|
||||
} else {
|
||||
del_mouse_termcode(KS_URXVT_MOUSE);
|
||||
/* There is no conflict with xterm mouse */
|
||||
if (use_xterm_mouse() == 4
|
||||
) {
|
||||
}
|
||||
// There is no conflict with xterm mouse.
|
||||
if (use_xterm_mouse() == 4) {
|
||||
set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME)
|
||||
? "\233<"
|
||||
: "\033[<"));
|
||||
@ -822,9 +824,10 @@ void check_mouse_termcode(void)
|
||||
mch_setmouse(FALSE);
|
||||
setmouse();
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
del_mouse_termcode(KS_SGR_MOUSE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to get the current window size:
|
||||
|
@ -152,6 +152,9 @@ char *UP, *BC, PC;
|
||||
# define TGETENT(b, t) tgetent((char *)(b), (char *)(t))
|
||||
#endif /* HAVE_TGETENT */
|
||||
|
||||
static int xt_index_in = 0;
|
||||
static int xt_index_out = 0;
|
||||
|
||||
static bool detected_8bit = false; // detected 8-bit terminal
|
||||
|
||||
static struct builtin_term builtin_termcaps[] =
|
||||
@ -2408,11 +2411,12 @@ void starttermcap(void)
|
||||
may_req_termresponse();
|
||||
/* Immediately check for a response. If t_Co changes, we don't
|
||||
* want to redraw with wrong colors first. */
|
||||
if (crv_status != CRV_GET)
|
||||
if (crv_status == CRV_SENT) {
|
||||
check_for_codes_from_term();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void stoptermcap(void)
|
||||
{
|
||||
@ -2446,6 +2450,38 @@ void stoptermcap(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(UNIX)
|
||||
/// Returns 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.
|
||||
bool did_request_esc_sequence(void)
|
||||
{
|
||||
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
|
||||
|| xt_index_out > xt_index_in;
|
||||
}
|
||||
|
||||
/// If requesting the version was disabled in did_request_esc_sequence(),
|
||||
/// enable it again.
|
||||
void resume_get_esc_sequence(void)
|
||||
{
|
||||
if (crv_status == 0) {
|
||||
crv_status = CRV_GET;
|
||||
}
|
||||
if (u7_status == 0) {
|
||||
u7_status = U7_GET;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Request version string (for xterm) when needed.
|
||||
* Only do this after switching to raw mode, otherwise the result will be
|
||||
@ -2458,6 +2494,8 @@ void stoptermcap(void)
|
||||
* Insert mode.
|
||||
* On Unix only do it when both output and input are a tty (avoid writing
|
||||
* 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().
|
||||
*/
|
||||
void may_req_termresponse(void)
|
||||
@ -2470,6 +2508,7 @@ void may_req_termresponse(void)
|
||||
# ifdef UNIX
|
||||
&& isatty(1)
|
||||
&& isatty(read_cmd_fd)
|
||||
&& !xterm_conflict_mouse
|
||||
# endif
|
||||
&& *T_CRV != NUL) {
|
||||
LOG_TR("Sending CRV");
|
||||
@ -4130,9 +4169,6 @@ int show_one_termcode(char_u *name, char_u *code, int printit)
|
||||
* termcap codes from the terminal itself.
|
||||
* 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 req_codes_from_term(void)
|
||||
{
|
||||
xt_index_out = 0;
|
||||
|
@ -236,7 +236,7 @@ static int included_patches[] = {
|
||||
362,
|
||||
361,
|
||||
//360,
|
||||
//359,
|
||||
359,
|
||||
358,
|
||||
357,
|
||||
//356 NA
|
||||
@ -290,7 +290,7 @@ static int included_patches[] = {
|
||||
308,
|
||||
//307 NA
|
||||
306,
|
||||
//305,
|
||||
305,
|
||||
//304 NA
|
||||
303,
|
||||
302,
|
||||
|
Loading…
Reference in New Issue
Block a user