]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.4.687 v7.4.687
authorBram Moolenaar <Bram@vim.org>
Tue, 31 Mar 2015 16:31:03 +0000 (18:31 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 31 Mar 2015 16:31:03 +0000 (18:31 +0200)
Problem:    There is no way to use a different in Replace mode for a terminal.
Solution:   Add t_SR. (Omar Sandoval)

runtime/doc/options.txt
runtime/doc/term.txt
src/option.c
src/term.c
src/term.h
src/version.c

index 39c3270fd2341cf15ec95626227a33ce3d1f4314..24a65bbecf86f1d72c1f0abe9e38ded942247383 100644 (file)
@@ -3420,7 +3420,8 @@ A jump table for the options with a short description can be found at |Q_op|.
        the height of the cursor can be changed.  This can be done by
        specifying a block cursor, or a percentage for a vertical or
        horizontal cursor.
-       For a console the 't_SI' and 't_EI' escape sequences are used.
+       For a console the 't_SI', 't_SR', and 't_EI' escape sequences are
+       used.
 
        The option is a comma separated list of parts.  Each part consist of a
        mode-list and an argument-list:
index 2ad4f677849312e12c2eb4f94c38d4f1dce65e79..717989ad944b1c9863721a64c1b2fe62e1ca3006 100644 (file)
@@ -294,7 +294,8 @@ Added by Vim (there are no standard codes for these):
        t_WP    set window position (Y, X) in pixels            *t_WP* *'t_WP'*
        t_WS    set window size (height, width) in characters   *t_WS* *'t_WS'*
        t_SI    start insert mode (bar cursor shape)            *t_SI* *'t_SI'*
-       t_EI    end insert mode (block cursor shape)            *t_EI* *'t_EI'*
+       t_SR    start replace mode (underline cursor shape)     *t_SR* *'t_SR'*
+       t_EI    end insert or replace mode (block cursor shape) *t_EI* *'t_EI'*
                |termcap-cursor-shape|
        t_RV    request terminal version string (for xterm)     *t_RV* *'t_RV'*
                |xterm-8bit| |v:termresponse| |'ttymouse'| |xterm-codes|
@@ -438,13 +439,16 @@ If one of these is not available, 't_Sb' and 't_Sf' are used.  't_me' is used
 to reset to the default colors.
 
                                *termcap-cursor-shape* *termcap-cursor-color*
-When Vim enters Insert mode the 't_SI' escape sequence is sent.  When leaving
-Insert mode 't_EI' is used.  But only if both are defined.  This can be used
-to change the shape or color of the cursor in Insert mode.  These are not
-standard termcap/terminfo entries, you need to set them yourself.
+When Vim enters Insert mode the 't_SI' escape sequence is sent.  When Vim
+enters Replace mode the 't_SR' escape sequence is sent if it is set, otherwise
+'t_SI' is sent.  When leaving Insert mode or Replace mode 't_EI' is used. This
+can be used to change the shape or color of the cursor in Insert or Replace
+mode. These are not standard termcap/terminfo entries, you need to set them
+yourself.
 Example for an xterm, this changes the color of the cursor: >
     if &term =~ "xterm"
        let &t_SI = "\<Esc>]12;purple\x7"
+       let &t_SR = "\<Esc>]12;red\x7"
        let &t_EI = "\<Esc>]12;blue\x7"
     endif
 NOTE: When Vim exits the shape for Normal mode will remain.  The shape from
index 6b3b00caa335a8c7dd33dae47d8b397314e4d2a3..cf3a3176265db291e833769bef420bb4c4d09317 100644 (file)
@@ -2978,6 +2978,7 @@ static struct vimoption
     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 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags)
            errmsg = e_invarg;
            curwin->w_p_nuw = 10;
        }
-       curwin->w_nrwidth_line_count = 0;
+       curwin->w_nrwidth_line_count = 0; /* trigger a redraw */
     }
 #endif
 
index 0d797bcd668797403ee44bd9aa9d329d687f989b..ffe9d43f2b4a4be958f4ea811a66092be51a8fa0 100644 (file)
@@ -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
index 28390a285cf2422d1a38b848675ed68039573347..12d5eb90953a8f4a5fda5eda46de0afa1bac8575 100644 (file)
@@ -81,6 +81,7 @@ enum SpecialKey
     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 @@ extern char_u *(term_strings[]);    /* current terminal strings */
 #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 */
index 89e70848a35c241ed2d1571799f057dd8e55a070..dcecdc451c77207ed1698eac845a49286d5d69f5 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    687,
 /**/
     686,
 /**/