1
0
forked from aniani/vim

patch 8.1.0719: too many #ifdefs

Problem:    Too many #ifdefs.
Solution:   Always build with the +visualextra feature.
This commit is contained in:
Bram Moolenaar
2019-01-11 14:37:20 +01:00
parent 402385a7f2
commit 870ba5f6dc
6 changed files with 23 additions and 69 deletions

View File

@@ -465,13 +465,13 @@ N *+viminfo* |'viminfo'|
since 8.0.1118.
in sync with the |+windows| feature
N *+virtualedit* |'virtualedit'|
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
N *+visualextra* extra Visual mode commands |blockwise-operators|
T *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
T *+visualextra* extra Visual mode commands |blockwise-operators|
T *+vreplace* |gR| and |gr|
*+vtp* on MS-Windows console: support for 'termguicolors'
N *+wildignore* |'wildignore'|
N *+wildmenu* |'wildmenu'|
*+windows* more than one window; Always enabled since 8.0.1118.
T *+windows* more than one window; Always enabled since 8.0.1118.
m *+writebackup* |'writebackup'| is default on
m *+xim* X input method |xim|
*+xfontset* X fontset support |xfontset|

View File

@@ -6533,9 +6533,7 @@ f_has(typval_T *argvars, typval_T *rettv)
"virtualedit",
#endif
"visual",
#ifdef FEAT_VISUALEXTRA
"visualextra",
#endif
"vreplace",
#ifdef FEAT_VTP
"vtp",

View File

@@ -194,10 +194,8 @@
/*
* +visual Visual mode - now always included.
* +visualextra Extra features for Visual mode (mostly block operators).
* Now always included.
*/
#ifdef FEAT_NORMAL
# define FEAT_VISUALEXTRA
#endif
/*
* +virtualedit 'virtualedit' option and its implementation

View File

@@ -1998,7 +1998,6 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
case OP_INSERT:
case OP_APPEND:
VIsual_reselect = FALSE; /* don't reselect now */
#ifdef FEAT_VISUALEXTRA
if (empty_region_error)
{
vim_beep(BO_OPER);
@@ -2035,21 +2034,15 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
else
cap->retval |= CA_COMMAND_BUSY;
}
#else
vim_beep(BO_OPER);
#endif
break;
case OP_REPLACE:
VIsual_reselect = FALSE; /* don't reselect now */
#ifdef FEAT_VISUALEXTRA
if (empty_region_error)
#endif
{
vim_beep(BO_OPER);
CancelRedo();
}
#ifdef FEAT_VISUALEXTRA
else
{
#ifdef FEAT_LINEBREAK
@@ -2063,7 +2056,6 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
#endif
op_replace(oap, cap->nchar);
}
#endif
break;
#ifdef FEAT_FOLDING

View File

@@ -82,20 +82,16 @@ struct block_def
colnr_T textcol; /* index of chars (partially) in block */
colnr_T start_vcol; /* start col of 1st char wholly inside block */
colnr_T end_vcol; /* start col of 1st char wholly after block */
#ifdef FEAT_VISUALEXTRA
int is_short; /* TRUE if line is too short to fit in block */
int is_MAX; /* TRUE if curswant==MAXCOL when starting */
int is_oneChar; /* TRUE if block within one character */
int pre_whitesp; /* screen cols of ws before block */
int pre_whitesp_c; /* chars of ws before block */
colnr_T end_char_vcols; /* number of vcols of post-block char */
#endif
colnr_T start_char_vcols; /* number of vcols of pre-block char */
};
#ifdef FEAT_VISUALEXTRA
static void shift_block(oparg_T *oap, int amount);
#endif
static int stuff_yank(int, char_u *);
static void put_reedit_in_typebuf(int silent);
static int put_in_typebuf(char_u *s, int esc, int colon,
@@ -255,10 +251,8 @@ op_shift(oparg_T *oap, int curs_top, int amount)
first_char = *ml_get_curline();
if (first_char == NUL) /* empty line */
curwin->w_cursor.col = 0;
#ifdef FEAT_VISUALEXTRA
else if (oap->block_mode)
shift_block(oap, amount);
#endif
else
/* Move the line right if it doesn't start with '#', 'smartindent'
* isn't set or 'cindent' isn't set or '#' isn't in 'cino'. */
@@ -322,8 +316,8 @@ op_shift(oparg_T *oap, int curs_top, int amount)
}
/*
* shift the current line one shiftwidth left (if left != 0) or right
* leaves cursor on first blank in the line
* Shift the current line one shiftwidth left (if left != 0) or right
* leaves cursor on first blank in the line.
*/
void
shift_line(
@@ -373,7 +367,6 @@ shift_line(
(void)set_indent(count, call_changed_bytes ? SIN_CHANGED : 0);
}
#if defined(FEAT_VISUALEXTRA) || defined(PROTO)
/*
* Shift one line of the current block one shiftwidth right or left.
* Leaves cursor on first character in block.
@@ -577,9 +570,7 @@ shift_block(oparg_T *oap, int amount)
p_ri = old_p_ri;
#endif
}
#endif
#ifdef FEAT_VISUALEXTRA
/*
* Insert string "s" (b_insert ? before : after) block :AKelly
* Caller must prepare for undo.
@@ -703,7 +694,6 @@ block_insert(
State = oldstate;
}
#endif
#if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(PROTO)
/*
@@ -2132,7 +2122,6 @@ mb_adjust_opend(oparg_T *oap)
}
#endif
#if defined(FEAT_VISUALEXTRA) || defined(PROTO)
#ifdef FEAT_MBYTE
/*
@@ -2150,8 +2139,8 @@ replace_character(int c)
/* Backup to the replaced character. */
dec_cursor();
}
#endif
/*
* Replace a whole area with one character.
*/
@@ -2406,7 +2395,6 @@ op_replace(oparg_T *oap, int c)
return OK;
}
#endif
static int swapchars(int op_type, pos_T *pos, int length);
@@ -2627,7 +2615,6 @@ swapchar(int op_type, pos_T *pos)
return FALSE;
}
#if defined(FEAT_VISUALEXTRA) || defined(PROTO)
/*
* op_insert - Insert and append operators for Visual mode.
*/
@@ -2844,7 +2831,6 @@ op_insert(oparg_T *oap, long count1)
}
}
}
#endif
/*
* op_change - handle a change operation
@@ -2856,7 +2842,6 @@ op_change(oparg_T *oap)
{
colnr_T l;
int retval;
#ifdef FEAT_VISUALEXTRA
long offset;
linenr_T linenr;
long ins_len;
@@ -2865,7 +2850,6 @@ op_change(oparg_T *oap)
char_u *firstline;
char_u *ins_text, *newp, *oldp;
struct block_def bd;
#endif
l = oap->start.col;
if (oap->motion_type == MLINE)
@@ -2895,7 +2879,6 @@ op_change(oparg_T *oap)
&& !virtual_op)
inc_cursor();
#ifdef FEAT_VISUALEXTRA
/* check for still on same line (<CR> in inserted text meaningless) */
/* skip blank lines too */
if (oap->block_mode)
@@ -2911,7 +2894,6 @@ op_change(oparg_T *oap)
pre_indent = (long)getwhitecols(firstline);
bd.textcol = curwin->w_cursor.col;
}
#endif
#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
if (oap->motion_type == MLINE)
@@ -2920,7 +2902,6 @@ op_change(oparg_T *oap)
retval = edit(NUL, FALSE, (linenr_T)1);
#ifdef FEAT_VISUALEXTRA
/*
* In Visual block mode, handle copying the new text to all lines of the
* block.
@@ -2995,7 +2976,6 @@ op_change(oparg_T *oap)
vim_free(ins_text);
}
}
#endif
return retval;
}
@@ -5415,13 +5395,11 @@ block_prep(
bdp->textlen = 0;
bdp->start_vcol = 0;
bdp->end_vcol = 0;
#ifdef FEAT_VISUALEXTRA
bdp->is_short = FALSE;
bdp->is_oneChar = FALSE;
bdp->pre_whitesp = 0;
bdp->pre_whitesp_c = 0;
bdp->end_char_vcols = 0;
#endif
bdp->start_char_vcols = 0;
line = ml_get(lnum);
@@ -5432,7 +5410,6 @@ block_prep(
/* Count a tab for what it's worth (if list mode not on) */
incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol);
bdp->start_vcol += incr;
#ifdef FEAT_VISUALEXTRA
if (VIM_ISWHITE(*pstart))
{
bdp->pre_whitesp += incr;
@@ -5443,7 +5420,6 @@ block_prep(
bdp->pre_whitesp = 0;
bdp->pre_whitesp_c = 0;
}
#endif
prev_pstart = pstart;
MB_PTR_ADV(pstart);
}
@@ -5451,9 +5427,7 @@ block_prep(
if (bdp->start_vcol < oap->start_vcol) /* line too short */
{
bdp->end_vcol = bdp->start_vcol;
#ifdef FEAT_VISUALEXTRA
bdp->is_short = TRUE;
#endif
if (!is_del || oap->op_type == OP_APPEND)
bdp->endspaces = oap->end_vcol - oap->start_vcol + 1;
}
@@ -5468,9 +5442,7 @@ block_prep(
bdp->end_vcol = bdp->start_vcol;
if (bdp->end_vcol > oap->end_vcol) /* it's all in one character */
{
#ifdef FEAT_VISUALEXTRA
bdp->is_oneChar = TRUE;
#endif
if (oap->op_type == OP_INSERT)
bdp->endspaces = bdp->start_char_vcols - bdp->startspaces;
else if (oap->op_type == OP_APPEND)
@@ -5507,9 +5479,7 @@ block_prep(
|| oap->op_type == OP_APPEND
|| oap->op_type == OP_REPLACE)) /* line too short */
{
#ifdef FEAT_VISUALEXTRA
bdp->is_short = TRUE;
#endif
/* Alternative: include spaces to fill up the block.
* Disadvantage: can lead to trailing spaces when the line is
* short where the text is put */
@@ -5531,9 +5501,7 @@ block_prep(
}
}
}
#ifdef FEAT_VISUALEXTRA
bdp->end_char_vcols = incr;
#endif
if (is_del && bdp->startspaces)
pstart = prev_pstart;
bdp->textlen = (int)(pend - pstart);
@@ -6624,7 +6592,7 @@ clip_free_selection(VimClipboard *cbd)
}
/*
* Get the selected text and put it in the gui selection register '*' or '+'.
* Get the selected text and put it in register '*' or '+'.
*/
void
clip_get_selection(VimClipboard *cbd)

View File

@@ -709,11 +709,7 @@ static char *(features[]) =
"-virtualedit",
#endif
"+visual",
#ifdef FEAT_VISUALEXTRA
"+visualextra",
#else
"-visualextra",
#endif
#ifdef FEAT_VIMINFO
"+viminfo",
#else
@@ -799,6 +795,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
719,
/**/
718,
/**/