0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

Make updating text for conceal mode simpler. A few compiler warning fixes.

This commit is contained in:
Bram Moolenaar
2010-07-02 20:20:09 +02:00
parent 730cde924c
commit b2c0350c67
17 changed files with 324 additions and 267 deletions

View File

@@ -2298,9 +2298,6 @@ 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;
@@ -2773,14 +2770,6 @@ 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)
@@ -5713,9 +5702,6 @@ 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();
@@ -5803,13 +5789,6 @@ 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
}
/*
@@ -5824,9 +5803,6 @@ nv_right(cap)
int PAST_LINE;
#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))
@@ -5932,13 +5908,6 @@ 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
}
/*
@@ -5951,9 +5920,6 @@ 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))
{
@@ -6012,13 +5978,6 @@ 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
}
/*
@@ -6037,21 +5996,11 @@ 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
}
}
@@ -6080,10 +6029,6 @@ 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)
@@ -6096,16 +6041,6 @@ 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
}
}
}
@@ -6664,7 +6599,7 @@ nv_percent(cap)
cmdarg_T *cap;
{
pos_T *pos;
#if defined(FEAT_FOLDING) || defined(FEAT_CONCEAL)
#if defined(FEAT_FOLDING)
linenr_T lnum = curwin->w_cursor.lnum;
#endif
@@ -6716,13 +6651,6 @@ 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
}
/*
@@ -6777,9 +6705,6 @@ 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;
@@ -6794,13 +6719,6 @@ 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
}
}
@@ -7723,9 +7641,6 @@ nv_g_cmd(cap)
#endif
int i;
int flag = FALSE;
#ifdef FEAT_CONCEAL
linenr_T oldline;
#endif
switch (cap->nchar)
{
@@ -7867,9 +7782,6 @@ 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)
@@ -7883,22 +7795,12 @@ 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)
@@ -7912,13 +7814,6 @@ 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;
/*
@@ -8545,9 +8440,6 @@ 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;
@@ -8557,13 +8449,6 @@ 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
}
/*
@@ -8578,9 +8463,6 @@ 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.
@@ -8658,13 +8540,6 @@ 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
}
/*
@@ -8827,10 +8702,6 @@ 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
}
/*
@@ -9255,9 +9126,6 @@ nv_put(cap)
void *reg1 = NULL, *reg2 = NULL;
int empty = FALSE;
int was_visual = FALSE;
#endif
#ifdef FEAT_CONCEAL
linenr_T oldline = curwin->w_cursor.lnum;
#endif
int dir;
int flags = 0;
@@ -9378,13 +9246,6 @@ 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
}
}