summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-05-22 18:14:31 +0200
committerBram Moolenaar <Bram@vim.org>2014-05-22 18:14:31 +0200
commit90013c6a751e6574fbe49b529a3dbf1eacbef43d (patch)
tree5d682bca18d37e731684b8496e3286e77e196ec0 /src/term.c
parentb777618d111e51b55ee452d3881d5ef5bc836765 (diff)
downloadvim-90013c6a751e6574fbe49b529a3dbf1eacbef43d.zip
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.
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/term.c b/src/term.c
index 41974de41..5251d6b9a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -153,6 +153,11 @@ char *UP, *BC, PC;
static char_u *vim_tgetstr __ARGS((char *s, char_u **pp));
#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 struct builtin_term builtin_termcaps[] =
@@ -3259,7 +3264,7 @@ starttermcap()
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();
}
#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)
/*
* Request version string (for xterm) when needed.
@@ -3319,6 +3348,8 @@ stoptermcap()
* 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
@@ -3332,6 +3363,7 @@ may_req_termresponse()
# ifdef UNIX
&& isatty(1)
&& isatty(read_cmd_fd)
+ && !xterm_conflict_mouse
# endif
&& *T_CRV != NUL)
{
@@ -5714,9 +5746,6 @@ show_one_termcode(name, code, 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()
{