diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-06-05 23:22:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-06-05 23:22:07 +0200 |
commit | 860cae1cec85aeb06668a2b071727c43869acf15 (patch) | |
tree | 8f7b62b69f4a7d3340902178927bbc3f9d24cc3e /src/normal.c | |
parent | 945e2dbb633ed29b697a8d4eea51672e3c11143b (diff) | |
download | vim-git-860cae1cec85aeb06668a2b071727c43869acf15.tar.gz |
Add the conceal patch from Vince Negri.
Diffstat (limited to 'src/normal.c')
-rw-r--r-- | src/normal.c | 117 |
1 files changed, 116 insertions, 1 deletions
diff --git a/src/normal.c b/src/normal.c index 3e8a492ec..002430d71 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1335,6 +1335,14 @@ normal_end: } #endif +#ifdef FEAT_CURSORBIND + if (curwin->w_p_crb && toplevel) + { + validate_cursor(); /* may need to update w_leftcol */ + do_check_cursorbind(); + } +#endif + /* * May restart edit(), if we got here with CTRL-O in Insert mode (but not * if still inside a mapping that started in Visual mode). @@ -2290,6 +2298,9 @@ do_mouse(oap, c, dir, count, fixindent) int old_mode = VIsual_mode; #endif int regname; +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif #if defined(FEAT_FOLDING) save_cursor = curwin->w_cursor; @@ -2762,6 +2773,14 @@ do_mouse(oap, c, dir, count, fixindent) curwin->w_cursor = save_cursor; } #endif +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal && moved + && (old_curwin != curwin || oldline != curwin->w_cursor.lnum)) + { + update_single_line(old_curwin, oldline); + update_single_line(curwin, curwin->w_cursor.lnum); + } +#endif #if defined(FEAT_CLIPBOARD) && defined(FEAT_CMDWIN) if ((jump_flags & IN_OTHER_WIN) && !VIsual_active && clip_star.available) @@ -5302,7 +5321,7 @@ nv_clear(cap) #endif #ifdef FEAT_SYN_HL /* Clear all syntax states to force resyncing. */ - syn_stack_free_all(curbuf); + syn_stack_free_all(curwin->w_s); #endif redraw_later(CLEAR); } @@ -5694,6 +5713,9 @@ nv_scroll(cap) linenr_T lnum; #endif int half; +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif cap->oap->motion_type = MLINE; setpcmark(); @@ -5781,6 +5803,13 @@ nv_scroll(cap) cursor_correct(); /* correct for 'so' */ beginline(BL_SOL | BL_FIX); +#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 } /* @@ -5796,6 +5825,9 @@ nv_right(cap) #else # define PAST_LINE 0 #endif +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { @@ -5900,6 +5932,13 @@ nv_right(cap) && 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 } /* @@ -5912,6 +5951,9 @@ nv_left(cap) cmdarg_T *cap; { long n; +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { @@ -5970,6 +6012,13 @@ nv_left(cap) && 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 } /* @@ -5988,11 +6037,21 @@ nv_up(cap) } else { +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif cap->oap->motion_type = MLINE; if (cursor_up(cap->count1, cap->oap->op_type == OP_NOP) == FAIL) clearopbeep(cap->oap); else if (cap->arg) beginline(BL_WHITE | BL_FIX); +#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 } } @@ -6021,6 +6080,10 @@ nv_down(cap) else #endif { +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; + linenr_T oldbotline = curwin->w_botline; +#endif #ifdef FEAT_CMDWIN /* In the cmdline window a <CR> executes the command. */ if (cmdwin_type != 0 && cap->cmdchar == CAR) @@ -6033,6 +6096,16 @@ nv_down(cap) clearopbeep(cap->oap); else if (cap->arg) beginline(BL_WHITE | BL_FIX); +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnum) + { + update_single_line(curwin, oldline); + /* Don't do this if we've scrolled, the line is already + * drawn */ + if (oldbotline == curwin->w_botline) + update_single_line(curwin, curwin->w_cursor.lnum); + } +#endif } } } @@ -8197,6 +8270,10 @@ nv_g_cmd(cap) n_opencmd(cap) cmdarg_T *cap; { +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif + if (!checkclearopq(cap->oap)) { #ifdef FEAT_FOLDING @@ -8220,6 +8297,10 @@ n_opencmd(cap) #endif 0, 0)) { +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnum) + update_single_line(curwin, oldline); +#endif /* When '#' is in 'cpoptions' ignore the count. */ if (vim_strchr(p_cpo, CPO_HASH) != NULL) cap->count1 = 1; @@ -8424,6 +8505,9 @@ nv_pipe(cap) nv_bck_word(cap) cmdarg_T *cap; { +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif cap->oap->motion_type = MCHAR; cap->oap->inclusive = FALSE; curwin->w_set_curswant = TRUE; @@ -8433,6 +8517,13 @@ nv_bck_word(cap) else if ((fdo_flags & FDO_HOR) && 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 } /* @@ -8447,6 +8538,9 @@ nv_wordcmd(cap) int word_end; int flag = FALSE; pos_T startpos = curwin->w_cursor; +#ifdef FEAT_CONCEAL + linenr_T oldline = startpos.lnum; +#endif /* * Set inclusive for the "E" and "e" command. @@ -8524,6 +8618,13 @@ nv_wordcmd(cap) 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 } /* @@ -8686,6 +8787,10 @@ nv_goto(cap) if ((fdo_flags & FDO_JUMP) && KeyTyped && cap->oap->op_type == OP_NOP) foldOpenCursor(); #endif +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal) + changed_window_setting(); +#endif } /* @@ -9111,6 +9216,9 @@ nv_put(cap) int empty = FALSE; int was_visual = FALSE; #endif +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif int dir; int flags = 0; @@ -9230,6 +9338,13 @@ nv_put(cap) } #endif auto_format(FALSE, TRUE); +#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 } } |