updated for version 7.4.687
Problem: There is no way to use a different in Replace mode for a terminal.
Solution: Add t_SR. (Omar Sandoval)
diff --git a/src/option.c b/src/option.c
index 6b3b00c..cf3a317 100644
--- a/src/option.c
+++ b/src/option.c
@@ -2978,6 +2978,7 @@
p_term("t_WS", T_CWS)
p_term("t_SI", T_CSI)
p_term("t_EI", T_CEI)
+ p_term("t_SR", T_CSR)
p_term("t_xn", T_XN)
p_term("t_xs", T_XS)
p_term("t_ZH", T_CZH)
@@ -8560,7 +8561,7 @@
errmsg = e_invarg;
curwin->w_p_nuw = 10;
}
- curwin->w_nrwidth_line_count = 0;
+ curwin->w_nrwidth_line_count = 0; /* trigger a redraw */
}
#endif
diff --git a/src/term.c b/src/term.c
index 0d797bc..ffe9d43 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3567,27 +3567,46 @@
#if defined(CURSOR_SHAPE) || defined(PROTO)
/*
- * Set cursor shape to match Insert mode.
+ * Set cursor shape to match Insert or Replace mode.
*/
void
term_cursor_shape()
{
- static int showing_insert_mode = MAYBE;
+ static int showing_mode = NORMAL;
+ char_u *p;
- if (!full_screen || *T_CSI == NUL || *T_CEI == NUL)
+ /* Only do something when redrawing the screen and we can restore the
+ * mode. */
+ if (!full_screen || *T_CEI == NUL)
return;
- if (State & INSERT)
+ if ((State & REPLACE) == REPLACE)
{
- if (showing_insert_mode != TRUE)
- out_str(T_CSI); /* Insert mode cursor */
- showing_insert_mode = TRUE;
+ if (showing_mode != REPLACE)
+ {
+ if (*T_CSR != NUL)
+ p = T_CSR; /* Replace mode cursor */
+ else
+ p = T_CSI; /* fall back to Insert mode cursor */
+ if (*p != NUL)
+ {
+ out_str(p);
+ showing_mode = REPLACE;
+ }
+ }
}
- else
+ else if (State & INSERT)
{
- if (showing_insert_mode != FALSE)
- out_str(T_CEI); /* non-Insert mode cursor */
- showing_insert_mode = FALSE;
+ if (showing_mode != INSERT && *T_CSI != NUL)
+ {
+ out_str(T_CSI); /* Insert mode cursor */
+ showing_mode = INSERT;
+ }
+ }
+ else if (showing_mode != NORMAL)
+ {
+ out_str(T_CEI); /* non-Insert mode cursor */
+ showing_mode = NORMAL;
}
}
#endif
diff --git a/src/term.h b/src/term.h
index 28390a2..12d5eb9 100644
--- a/src/term.h
+++ b/src/term.h
@@ -81,6 +81,7 @@
KS_CRV, /* request version string */
KS_CSI, /* start insert mode (bar cursor) */
KS_CEI, /* end insert mode (block cursor) */
+ KS_CSR, /* start replace mode (underline cursor) */
#ifdef FEAT_VERTSPLIT
KS_CSV, /* scroll region vertical */
#endif
@@ -159,6 +160,7 @@
#define T_CWS (term_str(KS_CWS)) /* window size */
#define T_CSI (term_str(KS_CSI)) /* start insert mode */
#define T_CEI (term_str(KS_CEI)) /* end insert mode */
+#define T_CSR (term_str(KS_CSR)) /* start replace mode */
#define T_CRV (term_str(KS_CRV)) /* request version string */
#define T_OP (term_str(KS_OP)) /* original color pair */
#define T_U7 (term_str(KS_U7)) /* request cursor position */
diff --git a/src/version.c b/src/version.c
index 89e7084..dcecdc4 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 687,
+/**/
686,
/**/
685,