aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/term.c
diff options
context:
space:
mode:
authorScott Prager <splinterofchaos@gmail.com>2014-09-09 13:13:23 -0400
committerScott Prager <splinterofchaos@gmail.com>2014-09-19 20:23:06 -0400
commit83cd2979a10bdab903e4f3f0f5bb0c85573522b6 (patch)
treeb096fdb5dfbb018462cd4be4212cf9ac92f22c02 /src/nvim/term.c
parentdc6db20febf1ce1848e87f8950c48a78aaffd8f6 (diff)
downloadrneovim-83cd2979a10bdab903e4f3f0f5bb0c85573522b6.tar.gz
rneovim-83cd2979a10bdab903e4f3f0f5bb0c85573522b6.tar.bz2
rneovim-83cd2979a10bdab903e4f3f0f5bb0c85573522b6.zip
vim-patch: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. https://code.google.com/p/vim/source/detail?r=v7-4-305
Diffstat (limited to 'src/nvim/term.c')
-rw-r--r--src/nvim/term.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/nvim/term.c b/src/nvim/term.c
index d2c524e2e8..7f52566c6f 100644
--- a/src/nvim/term.c
+++ b/src/nvim/term.c
@@ -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,8 +2411,9 @@ 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();
+ }
}
}
}
@@ -2446,6 +2450,26 @@ 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;
+}
+#endif
+
/*
* Request version string (for xterm) when needed.
* Only do this after switching to raw mode, otherwise the result will be
@@ -2458,6 +2482,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 +2496,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 +4157,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;