changeset 7422:35af1e06696b v7.4.1015

commit https://github.com/vim/vim/commit/c21d67e33c1b42a492e04788cbb14a23a6724e39 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 31 22:27:55 2015 +0100 patch 7.4.1015 Problem: The column is not restored properly when the matchparen plugin is used in Insert mode and the cursor is after the end of the line. Solution: Set the curswant flag. (Christian Brabandt). Also fix highlighting the match of the character before the cursor.
author Christian Brabandt <cb@256bit.org>
date Thu, 31 Dec 2015 22:30:05 +0100
parents d4385c9762b3
children ae2e842b9f6e
files runtime/plugin/matchparen.vim src/eval.c src/version.c
diffstat 3 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/plugin/matchparen.vim
+++ b/runtime/plugin/matchparen.vim
@@ -1,6 +1,6 @@
 " Vim plugin for showing matching parens
 " Maintainer:  Bram Moolenaar <Bram@vim.org>
-" Last Change: 2014 Jul 19
+" Last Change: 2015 Dec 31
 
 " Exit quickly when:
 " - this plugin was already loaded (or disabled)
@@ -55,7 +55,7 @@ function! s:Highlight_Matching_Pair()
   let before = 0
 
   let text = getline(c_lnum)
-  let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\)')
+  let matches = matchlist(text, '\(.\)\=\%'.c_col.'c\(.\=\)')
   if empty(matches)
     let [c_before, c] = ['', '']
   else
--- a/src/eval.c
+++ b/src/eval.c
@@ -10183,6 +10183,7 @@ f_cursor(argvars, rettv)
 #ifdef FEAT_VIRTUALEDIT
     long	coladd = 0;
 #endif
+    int		set_curswant = TRUE;
 
     rettv->vval.v_number = -1;
     if (argvars[1].v_type == VAR_UNKNOWN)
@@ -10198,7 +10199,10 @@ f_cursor(argvars, rettv)
 	coladd = pos.coladd;
 #endif
 	if (curswant >= 0)
+	{
 	    curwin->w_curswant = curswant - 1;
+	    set_curswant = FALSE;
+	}
     }
     else
     {
@@ -10231,7 +10235,7 @@ f_cursor(argvars, rettv)
 	mb_adjust_cursor();
 #endif
 
-    curwin->w_set_curswant = TRUE;
+    curwin->w_set_curswant = set_curswant;
     rettv->vval.v_number = 0;
 }
 
@@ -17524,7 +17528,10 @@ f_setpos(argvars, rettv)
 		{
 		    curwin->w_cursor = pos;
 		    if (curswant >= 0)
+		    {
 			curwin->w_curswant = curswant - 1;
+			curwin->w_set_curswant = FALSE;
+		    }
 		    check_cursor();
 		    rettv->vval.v_number = 0;
 		}
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1015,
+/**/
     1014,
 /**/
     1013,