]> granicus.if.org Git - vim/commitdiff
Fix conceal feature for gj, gk, etc. (Vince Negri)
authorBram Moolenaar <Bram@vim.org>
Tue, 8 Jun 2010 20:59:42 +0000 (22:59 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 8 Jun 2010 20:59:42 +0000 (22:59 +0200)
src/normal.c

index 002430d712dc7e5440ddd841c85a36abbb559858..e161d455d96673fa6c6fb73d63407f50ea83b972 100644 (file)
@@ -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;
@@ -6784,6 +6794,13 @@ nv_findpar(cap)
 #ifdef FEAT_FOLDING
        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;
 
     /*