summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-03-31 18:31:03 +0200
committerBram Moolenaar <Bram@vim.org>2015-03-31 18:31:03 +0200
commit1e7813a1872df80eec1760bdd9d80352b306ac56 (patch)
tree32f7645aa3470a563eeaba6c4802ac42b5c89e4c /src/term.c
parent7d2757a47204d00cd47e3db94f1bd248c499d4e3 (diff)
downloadvim-git-1e7813a1872df80eec1760bdd9d80352b306ac56.tar.gz
updated for version 7.4.687v7.4.687
Problem: There is no way to use a different in Replace mode for a terminal. Solution: Add t_SR. (Omar Sandoval)
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/term.c b/src/term.c
index 0d797bcd6..ffe9d43f2 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3567,27 +3567,46 @@ cursor_off()
#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)
+ 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 if (State & INSERT)
+ {
+ if (showing_mode != INSERT && *T_CSI != NUL)
+ {
out_str(T_CSI); /* Insert mode cursor */
- showing_insert_mode = TRUE;
+ showing_mode = INSERT;
+ }
}
- else
+ else if (showing_mode != NORMAL)
{
- if (showing_insert_mode != FALSE)
- out_str(T_CEI); /* non-Insert mode cursor */
- showing_insert_mode = FALSE;
+ out_str(T_CEI); /* non-Insert mode cursor */
+ showing_mode = NORMAL;
}
}
#endif