changeset 2259:9ea6208610ec vim73

Fix conceal feature for gj, gk, etc. (Vince Negri)
author Bram Moolenaar <bram@vim.org>
date Tue, 08 Jun 2010 22:59:42 +0200
parents 772bfca06c18
children 0e27866cea99
files src/normal.c
diffstat 1 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/normal.c
+++ b/src/normal.c
@@ -6664,7 +6664,7 @@ nv_percent(cap)
     cmdarg_T	*cap;
 {
     pos_T	*pos;
-#ifdef FEAT_FOLDING
+#if defined(FEAT_FOLDING) || defined(FEAT_CONCEAL)
     linenr_T	lnum = curwin->w_cursor.lnum;
 #endif
 
@@ -6716,6 +6716,13 @@ nv_percent(cap)
 	    && KeyTyped)
 	foldOpenCursor();
 #endif
+#ifdef FEAT_CONCEAL
+	if (curwin->w_p_conceal && lnum != curwin->w_cursor.lnum)
+	{
+	    update_single_line(curwin, lnum);
+	    update_single_line(curwin, curwin->w_cursor.lnum);
+	}
+#endif
 }
 
 /*
@@ -6770,6 +6777,9 @@ nv_mark(cap)
 nv_findpar(cap)
     cmdarg_T	*cap;
 {
+#ifdef FEAT_CONCEAL
+    linenr_T	oldline = curwin->w_cursor.lnum;
+#endif
     cap->oap->motion_type = MCHAR;
     cap->oap->inclusive = FALSE;
     cap->oap->use_reg_one = TRUE;
@@ -6785,6 +6795,13 @@ nv_findpar(cap)
 	if ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)
 	    foldOpenCursor();
 #endif
+#ifdef FEAT_CONCEAL
+	if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnum)
+	{
+	    update_single_line(curwin, oldline);
+	    update_single_line(curwin, curwin->w_cursor.lnum);
+	}
+#endif
     }
 }
 
@@ -7706,6 +7723,9 @@ nv_g_cmd(cap)
 #endif
     int		i;
     int		flag = FALSE;
+#ifdef FEAT_CONCEAL
+    linenr_T	oldline;
+#endif
 
     switch (cap->nchar)
     {
@@ -7847,6 +7867,9 @@ nv_g_cmd(cap)
     case K_DOWN:
 	/* with 'nowrap' it works just like the normal "j" command; also when
 	 * in a closed fold */
+#ifdef FEAT_CONCEAL
+	oldline = curwin->w_cursor.lnum;
+#endif
 	if (!curwin->w_p_wrap
 #ifdef FEAT_FOLDING
 		|| hasFolding(curwin->w_cursor.lnum, NULL, NULL)
@@ -7860,12 +7883,22 @@ nv_g_cmd(cap)
 	    i = nv_screengo(oap, FORWARD, cap->count1);
 	if (i == FAIL)
 	    clearopbeep(oap);
+#ifdef FEAT_CONCEAL
+	else if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnum)
+	{
+	    update_single_line(curwin, oldline);
+	    update_single_line(curwin, curwin->w_cursor.lnum);
+	}
+#endif
 	break;
 
     case 'k':
     case K_UP:
 	/* with 'nowrap' it works just like the normal "k" command; also when
 	 * in a closed fold */
+#ifdef FEAT_CONCEAL
+	oldline = curwin->w_cursor.lnum;
+#endif
 	if (!curwin->w_p_wrap
 #ifdef FEAT_FOLDING
 		|| hasFolding(curwin->w_cursor.lnum, NULL, NULL)
@@ -7879,6 +7912,13 @@ nv_g_cmd(cap)
 	    i = nv_screengo(oap, BACKWARD, cap->count1);
 	if (i == FAIL)
 	    clearopbeep(oap);
+#ifdef FEAT_CONCEAL
+	else if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnum)
+	{
+	    update_single_line(curwin, oldline);
+	    update_single_line(curwin, curwin->w_cursor.lnum);
+	}
+#endif
 	break;
 
     /*