Karsten Hopp cbd098
To: vim_dev@googlegroups.com
Karsten Hopp cbd098
Subject: Patch 7.4.687
Karsten Hopp cbd098
Fcc: outbox
Karsten Hopp cbd098
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp cbd098
Mime-Version: 1.0
Karsten Hopp cbd098
Content-Type: text/plain; charset=UTF-8
Karsten Hopp cbd098
Content-Transfer-Encoding: 8bit
Karsten Hopp cbd098
------------
Karsten Hopp cbd098
Karsten Hopp cbd098
Patch 7.4.687
Karsten Hopp cbd098
Problem:    There is no way to use a different in Replace mode for a terminal.
Karsten Hopp cbd098
Solution:   Add t_SR. (Omar Sandoval)
Karsten Hopp cbd098
Files:	    runtime/doc/options.txt, runtime/doc/term.txt,
Karsten Hopp cbd098
	    src/option.c, src/term.c, src/term.h
Karsten Hopp cbd098
Karsten Hopp cbd098
Karsten Hopp cbd098
*** ../vim-7.4.686/runtime/doc/options.txt	2015-01-27 15:58:37.202395482 +0100
Karsten Hopp cbd098
--- runtime/doc/options.txt	2015-03-31 18:01:58.465823918 +0200
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 3419,3425 ****
Karsten Hopp cbd098
  	the height of the cursor can be changed.  This can be done by
Karsten Hopp cbd098
  	specifying a block cursor, or a percentage for a vertical or
Karsten Hopp cbd098
  	horizontal cursor.
Karsten Hopp cbd098
! 	For a console the 't_SI' and 't_EI' escape sequences are used.
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  	The option is a comma separated list of parts.  Each part consist of a
Karsten Hopp cbd098
  	mode-list and an argument-list:
Karsten Hopp cbd098
--- 3420,3427 ----
Karsten Hopp cbd098
  	the height of the cursor can be changed.  This can be done by
Karsten Hopp cbd098
  	specifying a block cursor, or a percentage for a vertical or
Karsten Hopp cbd098
  	horizontal cursor.
Karsten Hopp cbd098
! 	For a console the 't_SI', 't_SR', and 't_EI' escape sequences are
Karsten Hopp cbd098
! 	used.
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  	The option is a comma separated list of parts.  Each part consist of a
Karsten Hopp cbd098
  	mode-list and an argument-list:
Karsten Hopp cbd098
*** ../vim-7.4.686/runtime/doc/term.txt	2015-02-10 19:20:33.727792128 +0100
Karsten Hopp cbd098
--- runtime/doc/term.txt	2015-03-31 18:01:58.465823918 +0200
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 283,290 ****
Karsten Hopp cbd098
  								*t_xs* *'t_xs'*
Karsten Hopp cbd098
  	t_xs	if non-empty, standout not erased by overwriting (hpterm)
Karsten Hopp cbd098
  								*t_xn* *'t_xn'*
Karsten Hopp cbd098
! 	t_xn	if non-empty, character writing at the last cell of screen
Karsten Hopp cbd098
! 		didn't causes scrolling
Karsten Hopp cbd098
  	t_ZH	italics mode					*t_ZH* *'t_ZH'*
Karsten Hopp cbd098
  	t_ZR	italics end					*t_ZR* *'t_ZR'*
Karsten Hopp cbd098
  
Karsten Hopp cbd098
--- 283,290 ----
Karsten Hopp cbd098
  								*t_xs* *'t_xs'*
Karsten Hopp cbd098
  	t_xs	if non-empty, standout not erased by overwriting (hpterm)
Karsten Hopp cbd098
  								*t_xn* *'t_xn'*
Karsten Hopp cbd098
! 	t_xn	if non-empty, writing a character at the last screen cell
Karsten Hopp cbd098
! 		does not cause scrolling
Karsten Hopp cbd098
  	t_ZH	italics mode					*t_ZH* *'t_ZH'*
Karsten Hopp cbd098
  	t_ZR	italics end					*t_ZR* *'t_ZR'*
Karsten Hopp cbd098
  
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 294,300 ****
Karsten Hopp cbd098
  	t_WP	set window position (Y, X) in pixels		*t_WP* *'t_WP'*
Karsten Hopp cbd098
  	t_WS	set window size (height, width) in characters	*t_WS* *'t_WS'*
Karsten Hopp cbd098
  	t_SI	start insert mode (bar cursor shape)		*t_SI* *'t_SI'*
Karsten Hopp cbd098
! 	t_EI	end insert mode (block cursor shape)		*t_EI* *'t_EI'*
Karsten Hopp cbd098
  		|termcap-cursor-shape|
Karsten Hopp cbd098
  	t_RV	request terminal version string (for xterm)	*t_RV* *'t_RV'*
Karsten Hopp cbd098
  		|xterm-8bit| |v:termresponse| |'ttymouse'| |xterm-codes|
Karsten Hopp cbd098
--- 294,301 ----
Karsten Hopp cbd098
  	t_WP	set window position (Y, X) in pixels		*t_WP* *'t_WP'*
Karsten Hopp cbd098
  	t_WS	set window size (height, width) in characters	*t_WS* *'t_WS'*
Karsten Hopp cbd098
  	t_SI	start insert mode (bar cursor shape)		*t_SI* *'t_SI'*
Karsten Hopp cbd098
! 	t_SR	start replace mode (underline cursor shape)	*t_SR* *'t_SR'*
Karsten Hopp cbd098
! 	t_EI	end insert or replace mode (block cursor shape)	*t_EI* *'t_EI'*
Karsten Hopp cbd098
  		|termcap-cursor-shape|
Karsten Hopp cbd098
  	t_RV	request terminal version string (for xterm)	*t_RV* *'t_RV'*
Karsten Hopp cbd098
  		|xterm-8bit| |v:termresponse| |'ttymouse'| |xterm-codes|
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 438,450 ****
Karsten Hopp cbd098
  to reset to the default colors.
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  				*termcap-cursor-shape* *termcap-cursor-color*
Karsten Hopp cbd098
! When Vim enters Insert mode the 't_SI' escape sequence is sent.  When leaving
Karsten Hopp cbd098
! Insert mode 't_EI' is used.  But only if both are defined.  This can be used
Karsten Hopp cbd098
! to change the shape or color of the cursor in Insert mode.  These are not
Karsten Hopp cbd098
! standard termcap/terminfo entries, you need to set them yourself.
Karsten Hopp cbd098
  Example for an xterm, this changes the color of the cursor: >
Karsten Hopp cbd098
      if &term =~ "xterm"
Karsten Hopp cbd098
  	let &t_SI = "\<Esc>]12;purple\x7"
Karsten Hopp cbd098
  	let &t_EI = "\<Esc>]12;blue\x7"
Karsten Hopp cbd098
      endif
Karsten Hopp cbd098
  NOTE: When Vim exits the shape for Normal mode will remain.  The shape from
Karsten Hopp cbd098
--- 439,454 ----
Karsten Hopp cbd098
  to reset to the default colors.
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  				*termcap-cursor-shape* *termcap-cursor-color*
Karsten Hopp cbd098
! When Vim enters Insert mode the 't_SI' escape sequence is sent.  When Vim
Karsten Hopp cbd098
! enters Replace mode the 't_SR' escape sequence is sent if it is set, otherwise
Karsten Hopp cbd098
! 't_SI' is sent.  When leaving Insert mode or Replace mode 't_EI' is used. This
Karsten Hopp cbd098
! can be used to change the shape or color of the cursor in Insert or Replace
Karsten Hopp cbd098
! mode. These are not standard termcap/terminfo entries, you need to set them
Karsten Hopp cbd098
! yourself.
Karsten Hopp cbd098
  Example for an xterm, this changes the color of the cursor: >
Karsten Hopp cbd098
      if &term =~ "xterm"
Karsten Hopp cbd098
  	let &t_SI = "\<Esc>]12;purple\x7"
Karsten Hopp cbd098
+ 	let &t_SR = "\<Esc>]12;red\x7"
Karsten Hopp cbd098
  	let &t_EI = "\<Esc>]12;blue\x7"
Karsten Hopp cbd098
      endif
Karsten Hopp cbd098
  NOTE: When Vim exits the shape for Normal mode will remain.  The shape from
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 670,677 ****
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  							*xterm-copy-paste*
Karsten Hopp cbd098
  NOTE: In some (older) xterms, it's not possible to move the cursor past column
Karsten Hopp cbd098
! 95.  This is an xterm problem, not Vim's.  Get a newer xterm |color-xterm|.
Karsten Hopp cbd098
! Now the limit is 223 columns.
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  Copy/paste in xterm with (current mode NOT included in 'mouse'):
Karsten Hopp cbd098
  1. Press left mouse button on first letter of text, move mouse pointer to last
Karsten Hopp cbd098
--- 674,681 ----
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  							*xterm-copy-paste*
Karsten Hopp cbd098
  NOTE: In some (older) xterms, it's not possible to move the cursor past column
Karsten Hopp cbd098
! 95 or 223.  This is an xterm problem, not Vim's.  Get a newer xterm
Karsten Hopp cbd098
! |color-xterm|.  Also see |'ttymouse'|.
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  Copy/paste in xterm with (current mode NOT included in 'mouse'):
Karsten Hopp cbd098
  1. Press left mouse button on first letter of text, move mouse pointer to last
Karsten Hopp cbd098
*** ../vim-7.4.686/src/option.c	2015-03-13 11:23:46.446245826 +0100
Karsten Hopp cbd098
--- src/option.c	2015-03-31 18:02:34.637429081 +0200
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 2978,2983 ****
Karsten Hopp cbd098
--- 2978,2984 ----
Karsten Hopp cbd098
      p_term("t_WS", T_CWS)
Karsten Hopp cbd098
      p_term("t_SI", T_CSI)
Karsten Hopp cbd098
      p_term("t_EI", T_CEI)
Karsten Hopp cbd098
+     p_term("t_SR", T_CSR)
Karsten Hopp cbd098
      p_term("t_xn", T_XN)
Karsten Hopp cbd098
      p_term("t_xs", T_XS)
Karsten Hopp cbd098
      p_term("t_ZH", T_CZH)
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 8560,8566 ****
Karsten Hopp cbd098
  	    errmsg = e_invarg;
Karsten Hopp cbd098
  	    curwin->w_p_nuw = 10;
Karsten Hopp cbd098
  	}
Karsten Hopp cbd098
! 	curwin->w_nrwidth_line_count = 0;
Karsten Hopp cbd098
      }
Karsten Hopp cbd098
  #endif
Karsten Hopp cbd098
  
Karsten Hopp cbd098
--- 8561,8567 ----
Karsten Hopp cbd098
  	    errmsg = e_invarg;
Karsten Hopp cbd098
  	    curwin->w_p_nuw = 10;
Karsten Hopp cbd098
  	}
Karsten Hopp cbd098
! 	curwin->w_nrwidth_line_count = 0; /* trigger a redraw */
Karsten Hopp cbd098
      }
Karsten Hopp cbd098
  #endif
Karsten Hopp cbd098
  
Karsten Hopp cbd098
*** ../vim-7.4.686/src/term.c	2015-02-10 19:20:33.735792024 +0100
Karsten Hopp cbd098
--- src/term.c	2015-03-31 18:17:22.223741055 +0200
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 3567,3593 ****
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  #if defined(CURSOR_SHAPE) || defined(PROTO)
Karsten Hopp cbd098
  /*
Karsten Hopp cbd098
!  * Set cursor shape to match Insert mode.
Karsten Hopp cbd098
   */
Karsten Hopp cbd098
      void
Karsten Hopp cbd098
  term_cursor_shape()
Karsten Hopp cbd098
  {
Karsten Hopp cbd098
!     static int showing_insert_mode = MAYBE;
Karsten Hopp cbd098
  
Karsten Hopp cbd098
!     if (!full_screen || *T_CSI == NUL || *T_CEI == NUL)
Karsten Hopp cbd098
  	return;
Karsten Hopp cbd098
  
Karsten Hopp cbd098
!     if (State & INSERT)
Karsten Hopp cbd098
      {
Karsten Hopp cbd098
! 	if (showing_insert_mode != TRUE)
Karsten Hopp cbd098
  	    out_str(T_CSI);	    /* Insert mode cursor */
Karsten Hopp cbd098
! 	showing_insert_mode = TRUE;
Karsten Hopp cbd098
      }
Karsten Hopp cbd098
!     else
Karsten Hopp cbd098
      {
Karsten Hopp cbd098
! 	if (showing_insert_mode != FALSE)
Karsten Hopp cbd098
! 	    out_str(T_CEI);	    /* non-Insert mode cursor */
Karsten Hopp cbd098
! 	showing_insert_mode = FALSE;
Karsten Hopp cbd098
      }
Karsten Hopp cbd098
  }
Karsten Hopp cbd098
  #endif
Karsten Hopp cbd098
--- 3567,3612 ----
Karsten Hopp cbd098
  
Karsten Hopp cbd098
  #if defined(CURSOR_SHAPE) || defined(PROTO)
Karsten Hopp cbd098
  /*
Karsten Hopp cbd098
!  * Set cursor shape to match Insert or Replace mode.
Karsten Hopp cbd098
   */
Karsten Hopp cbd098
      void
Karsten Hopp cbd098
  term_cursor_shape()
Karsten Hopp cbd098
  {
Karsten Hopp cbd098
!     static int showing_mode = NORMAL;
Karsten Hopp cbd098
!     char_u *p;
Karsten Hopp cbd098
  
Karsten Hopp cbd098
!     /* Only do something when redrawing the screen and we can restore the
Karsten Hopp cbd098
!      * mode. */
Karsten Hopp cbd098
!     if (!full_screen || *T_CEI == NUL)
Karsten Hopp cbd098
  	return;
Karsten Hopp cbd098
  
Karsten Hopp cbd098
!     if ((State & REPLACE) == REPLACE)
Karsten Hopp cbd098
      {
Karsten Hopp cbd098
! 	if (showing_mode != REPLACE)
Karsten Hopp cbd098
! 	{
Karsten Hopp cbd098
! 	    if (*T_CSR != NUL)
Karsten Hopp cbd098
! 		p = T_CSR;	/* Replace mode cursor */
Karsten Hopp cbd098
! 	    else
Karsten Hopp cbd098
! 		p = T_CSI;	/* fall back to Insert mode cursor */
Karsten Hopp cbd098
! 	    if (*p != NUL)
Karsten Hopp cbd098
! 	    {
Karsten Hopp cbd098
! 		out_str(p);
Karsten Hopp cbd098
! 		showing_mode = REPLACE;
Karsten Hopp cbd098
! 	    }
Karsten Hopp cbd098
! 	}
Karsten Hopp cbd098
!     }
Karsten Hopp cbd098
!     else if (State & INSERT)
Karsten Hopp cbd098
!     {
Karsten Hopp cbd098
! 	if (showing_mode != INSERT && *T_CSI != NUL)
Karsten Hopp cbd098
! 	{
Karsten Hopp cbd098
  	    out_str(T_CSI);	    /* Insert mode cursor */
Karsten Hopp cbd098
! 	    showing_mode = INSERT;
Karsten Hopp cbd098
! 	}
Karsten Hopp cbd098
      }
Karsten Hopp cbd098
!     else if (showing_mode != NORMAL)
Karsten Hopp cbd098
      {
Karsten Hopp cbd098
! 	out_str(T_CEI);		    /* non-Insert mode cursor */
Karsten Hopp cbd098
! 	showing_mode = NORMAL;
Karsten Hopp cbd098
      }
Karsten Hopp cbd098
  }
Karsten Hopp cbd098
  #endif
Karsten Hopp cbd098
*** ../vim-7.4.686/src/term.h	2015-02-10 19:20:33.739791972 +0100
Karsten Hopp cbd098
--- src/term.h	2015-03-31 18:01:58.469823874 +0200
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 81,86 ****
Karsten Hopp cbd098
--- 81,87 ----
Karsten Hopp cbd098
      KS_CRV,	/* request version string */
Karsten Hopp cbd098
      KS_CSI,	/* start insert mode (bar cursor) */
Karsten Hopp cbd098
      KS_CEI,	/* end insert mode (block cursor) */
Karsten Hopp cbd098
+     KS_CSR,	/* start replace mode (underline cursor) */
Karsten Hopp cbd098
  #ifdef FEAT_VERTSPLIT
Karsten Hopp cbd098
      KS_CSV,	/* scroll region vertical */
Karsten Hopp cbd098
  #endif
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 159,164 ****
Karsten Hopp cbd098
--- 160,166 ----
Karsten Hopp cbd098
  #define T_CWS	(term_str(KS_CWS))	/* window size */
Karsten Hopp cbd098
  #define T_CSI	(term_str(KS_CSI))	/* start insert mode */
Karsten Hopp cbd098
  #define T_CEI	(term_str(KS_CEI))	/* end insert mode */
Karsten Hopp cbd098
+ #define T_CSR	(term_str(KS_CSR))	/* start replace mode */
Karsten Hopp cbd098
  #define T_CRV	(term_str(KS_CRV))	/* request version string */
Karsten Hopp cbd098
  #define T_OP	(term_str(KS_OP))	/* original color pair */
Karsten Hopp cbd098
  #define T_U7	(term_str(KS_U7))	/* request cursor position */
Karsten Hopp cbd098
*** ../vim-7.4.686/src/version.c	2015-03-31 17:46:16.844128018 +0200
Karsten Hopp cbd098
--- src/version.c	2015-03-31 18:03:18.352951899 +0200
Karsten Hopp cbd098
***************
Karsten Hopp cbd098
*** 743,744 ****
Karsten Hopp cbd098
--- 743,746 ----
Karsten Hopp cbd098
  {   /* Add new patch number below this line */
Karsten Hopp cbd098
+ /**/
Karsten Hopp cbd098
+     687,
Karsten Hopp cbd098
  /**/
Karsten Hopp cbd098
Karsten Hopp cbd098
-- 
Karsten Hopp cbd098
It is illegal to rob a bank and then shoot at the bank teller with a water
Karsten Hopp cbd098
pistol.
Karsten Hopp cbd098
		[real standing law in Louisana, United States of America]
Karsten Hopp cbd098
Karsten Hopp cbd098
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp cbd098
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp cbd098
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp cbd098
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///