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:
@@ -465,13 +465,13 @@ N *+viminfo* |'viminfo'|
|
|||||||
since 8.0.1118.
|
since 8.0.1118.
|
||||||
in sync with the |+windows| feature
|
in sync with the |+windows| feature
|
||||||
N *+virtualedit* |'virtualedit'|
|
N *+virtualedit* |'virtualedit'|
|
||||||
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
|
T *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
|
||||||
N *+visualextra* extra Visual mode commands |blockwise-operators|
|
T *+visualextra* extra Visual mode commands |blockwise-operators|
|
||||||
T *+vreplace* |gR| and |gr|
|
T *+vreplace* |gR| and |gr|
|
||||||
*+vtp* on MS-Windows console: support for 'termguicolors'
|
*+vtp* on MS-Windows console: support for 'termguicolors'
|
||||||
N *+wildignore* |'wildignore'|
|
N *+wildignore* |'wildignore'|
|
||||||
N *+wildmenu* |'wildmenu'|
|
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 *+writebackup* |'writebackup'| is default on
|
||||||
m *+xim* X input method |xim|
|
m *+xim* X input method |xim|
|
||||||
*+xfontset* X fontset support |xfontset|
|
*+xfontset* X fontset support |xfontset|
|
||||||
|
@@ -6533,9 +6533,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
"virtualedit",
|
"virtualedit",
|
||||||
#endif
|
#endif
|
||||||
"visual",
|
"visual",
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
"visualextra",
|
"visualextra",
|
||||||
#endif
|
|
||||||
"vreplace",
|
"vreplace",
|
||||||
#ifdef FEAT_VTP
|
#ifdef FEAT_VTP
|
||||||
"vtp",
|
"vtp",
|
||||||
|
@@ -194,10 +194,8 @@
|
|||||||
/*
|
/*
|
||||||
* +visual Visual mode - now always included.
|
* +visual Visual mode - now always included.
|
||||||
* +visualextra Extra features for Visual mode (mostly block operators).
|
* +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
|
* +virtualedit 'virtualedit' option and its implementation
|
||||||
|
@@ -1998,7 +1998,6 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
|
|||||||
case OP_INSERT:
|
case OP_INSERT:
|
||||||
case OP_APPEND:
|
case OP_APPEND:
|
||||||
VIsual_reselect = FALSE; /* don't reselect now */
|
VIsual_reselect = FALSE; /* don't reselect now */
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
if (empty_region_error)
|
if (empty_region_error)
|
||||||
{
|
{
|
||||||
vim_beep(BO_OPER);
|
vim_beep(BO_OPER);
|
||||||
@@ -2035,21 +2034,15 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
|
|||||||
else
|
else
|
||||||
cap->retval |= CA_COMMAND_BUSY;
|
cap->retval |= CA_COMMAND_BUSY;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
vim_beep(BO_OPER);
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_REPLACE:
|
case OP_REPLACE:
|
||||||
VIsual_reselect = FALSE; /* don't reselect now */
|
VIsual_reselect = FALSE; /* don't reselect now */
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
if (empty_region_error)
|
if (empty_region_error)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
vim_beep(BO_OPER);
|
vim_beep(BO_OPER);
|
||||||
CancelRedo();
|
CancelRedo();
|
||||||
}
|
}
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef FEAT_LINEBREAK
|
#ifdef FEAT_LINEBREAK
|
||||||
@@ -2063,7 +2056,6 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
|
|||||||
#endif
|
#endif
|
||||||
op_replace(oap, cap->nchar);
|
op_replace(oap, cap->nchar);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
|
40
src/ops.c
40
src/ops.c
@@ -82,20 +82,16 @@ struct block_def
|
|||||||
colnr_T textcol; /* index of chars (partially) in block */
|
colnr_T textcol; /* index of chars (partially) in block */
|
||||||
colnr_T start_vcol; /* start col of 1st char wholly inside 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 */
|
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_short; /* TRUE if line is too short to fit in block */
|
||||||
int is_MAX; /* TRUE if curswant==MAXCOL when starting */
|
int is_MAX; /* TRUE if curswant==MAXCOL when starting */
|
||||||
int is_oneChar; /* TRUE if block within one character */
|
int is_oneChar; /* TRUE if block within one character */
|
||||||
int pre_whitesp; /* screen cols of ws before block */
|
int pre_whitesp; /* screen cols of ws before block */
|
||||||
int pre_whitesp_c; /* chars 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 */
|
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 */
|
colnr_T start_char_vcols; /* number of vcols of pre-block char */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
static void shift_block(oparg_T *oap, int amount);
|
static void shift_block(oparg_T *oap, int amount);
|
||||||
#endif
|
|
||||||
static int stuff_yank(int, char_u *);
|
static int stuff_yank(int, char_u *);
|
||||||
static void put_reedit_in_typebuf(int silent);
|
static void put_reedit_in_typebuf(int silent);
|
||||||
static int put_in_typebuf(char_u *s, int esc, int colon,
|
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();
|
first_char = *ml_get_curline();
|
||||||
if (first_char == NUL) /* empty line */
|
if (first_char == NUL) /* empty line */
|
||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
else if (oap->block_mode)
|
else if (oap->block_mode)
|
||||||
shift_block(oap, amount);
|
shift_block(oap, amount);
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
/* Move the line right if it doesn't start with '#', 'smartindent'
|
/* Move the line right if it doesn't start with '#', 'smartindent'
|
||||||
* isn't set or 'cindent' isn't set or '#' isn't in 'cino'. */
|
* 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
|
* Shift the current line one shiftwidth left (if left != 0) or right
|
||||||
* leaves cursor on first blank in the line
|
* leaves cursor on first blank in the line.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
shift_line(
|
shift_line(
|
||||||
@@ -373,7 +367,6 @@ shift_line(
|
|||||||
(void)set_indent(count, call_changed_bytes ? SIN_CHANGED : 0);
|
(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.
|
* Shift one line of the current block one shiftwidth right or left.
|
||||||
* Leaves cursor on first character in block.
|
* Leaves cursor on first character in block.
|
||||||
@@ -577,9 +570,7 @@ shift_block(oparg_T *oap, int amount)
|
|||||||
p_ri = old_p_ri;
|
p_ri = old_p_ri;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
/*
|
/*
|
||||||
* Insert string "s" (b_insert ? before : after) block :AKelly
|
* Insert string "s" (b_insert ? before : after) block :AKelly
|
||||||
* Caller must prepare for undo.
|
* Caller must prepare for undo.
|
||||||
@@ -703,7 +694,6 @@ block_insert(
|
|||||||
|
|
||||||
State = oldstate;
|
State = oldstate;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(PROTO)
|
#if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
@@ -2132,7 +2122,6 @@ mb_adjust_opend(oparg_T *oap)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_VISUALEXTRA) || defined(PROTO)
|
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
/*
|
/*
|
||||||
@@ -2150,8 +2139,8 @@ replace_character(int c)
|
|||||||
/* Backup to the replaced character. */
|
/* Backup to the replaced character. */
|
||||||
dec_cursor();
|
dec_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Replace a whole area with one character.
|
* Replace a whole area with one character.
|
||||||
*/
|
*/
|
||||||
@@ -2406,7 +2395,6 @@ op_replace(oparg_T *oap, int c)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int swapchars(int op_type, pos_T *pos, int length);
|
static int swapchars(int op_type, pos_T *pos, int length);
|
||||||
|
|
||||||
@@ -2627,7 +2615,6 @@ swapchar(int op_type, pos_T *pos)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_VISUALEXTRA) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* op_insert - Insert and append operators for Visual mode.
|
* 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
|
* op_change - handle a change operation
|
||||||
@@ -2856,7 +2842,6 @@ op_change(oparg_T *oap)
|
|||||||
{
|
{
|
||||||
colnr_T l;
|
colnr_T l;
|
||||||
int retval;
|
int retval;
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
long offset;
|
long offset;
|
||||||
linenr_T linenr;
|
linenr_T linenr;
|
||||||
long ins_len;
|
long ins_len;
|
||||||
@@ -2865,7 +2850,6 @@ op_change(oparg_T *oap)
|
|||||||
char_u *firstline;
|
char_u *firstline;
|
||||||
char_u *ins_text, *newp, *oldp;
|
char_u *ins_text, *newp, *oldp;
|
||||||
struct block_def bd;
|
struct block_def bd;
|
||||||
#endif
|
|
||||||
|
|
||||||
l = oap->start.col;
|
l = oap->start.col;
|
||||||
if (oap->motion_type == MLINE)
|
if (oap->motion_type == MLINE)
|
||||||
@@ -2895,7 +2879,6 @@ op_change(oparg_T *oap)
|
|||||||
&& !virtual_op)
|
&& !virtual_op)
|
||||||
inc_cursor();
|
inc_cursor();
|
||||||
|
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
/* check for still on same line (<CR> in inserted text meaningless) */
|
/* check for still on same line (<CR> in inserted text meaningless) */
|
||||||
/* skip blank lines too */
|
/* skip blank lines too */
|
||||||
if (oap->block_mode)
|
if (oap->block_mode)
|
||||||
@@ -2911,7 +2894,6 @@ op_change(oparg_T *oap)
|
|||||||
pre_indent = (long)getwhitecols(firstline);
|
pre_indent = (long)getwhitecols(firstline);
|
||||||
bd.textcol = curwin->w_cursor.col;
|
bd.textcol = curwin->w_cursor.col;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
|
#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
|
||||||
if (oap->motion_type == MLINE)
|
if (oap->motion_type == MLINE)
|
||||||
@@ -2920,7 +2902,6 @@ op_change(oparg_T *oap)
|
|||||||
|
|
||||||
retval = edit(NUL, FALSE, (linenr_T)1);
|
retval = edit(NUL, FALSE, (linenr_T)1);
|
||||||
|
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
/*
|
/*
|
||||||
* In Visual block mode, handle copying the new text to all lines of the
|
* In Visual block mode, handle copying the new text to all lines of the
|
||||||
* block.
|
* block.
|
||||||
@@ -2995,7 +2976,6 @@ op_change(oparg_T *oap)
|
|||||||
vim_free(ins_text);
|
vim_free(ins_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -5415,13 +5395,11 @@ block_prep(
|
|||||||
bdp->textlen = 0;
|
bdp->textlen = 0;
|
||||||
bdp->start_vcol = 0;
|
bdp->start_vcol = 0;
|
||||||
bdp->end_vcol = 0;
|
bdp->end_vcol = 0;
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
bdp->is_short = FALSE;
|
bdp->is_short = FALSE;
|
||||||
bdp->is_oneChar = FALSE;
|
bdp->is_oneChar = FALSE;
|
||||||
bdp->pre_whitesp = 0;
|
bdp->pre_whitesp = 0;
|
||||||
bdp->pre_whitesp_c = 0;
|
bdp->pre_whitesp_c = 0;
|
||||||
bdp->end_char_vcols = 0;
|
bdp->end_char_vcols = 0;
|
||||||
#endif
|
|
||||||
bdp->start_char_vcols = 0;
|
bdp->start_char_vcols = 0;
|
||||||
|
|
||||||
line = ml_get(lnum);
|
line = ml_get(lnum);
|
||||||
@@ -5432,7 +5410,6 @@ block_prep(
|
|||||||
/* Count a tab for what it's worth (if list mode not on) */
|
/* Count a tab for what it's worth (if list mode not on) */
|
||||||
incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol);
|
incr = lbr_chartabsize(line, pstart, (colnr_T)bdp->start_vcol);
|
||||||
bdp->start_vcol += incr;
|
bdp->start_vcol += incr;
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
if (VIM_ISWHITE(*pstart))
|
if (VIM_ISWHITE(*pstart))
|
||||||
{
|
{
|
||||||
bdp->pre_whitesp += incr;
|
bdp->pre_whitesp += incr;
|
||||||
@@ -5443,7 +5420,6 @@ block_prep(
|
|||||||
bdp->pre_whitesp = 0;
|
bdp->pre_whitesp = 0;
|
||||||
bdp->pre_whitesp_c = 0;
|
bdp->pre_whitesp_c = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
prev_pstart = pstart;
|
prev_pstart = pstart;
|
||||||
MB_PTR_ADV(pstart);
|
MB_PTR_ADV(pstart);
|
||||||
}
|
}
|
||||||
@@ -5451,9 +5427,7 @@ block_prep(
|
|||||||
if (bdp->start_vcol < oap->start_vcol) /* line too short */
|
if (bdp->start_vcol < oap->start_vcol) /* line too short */
|
||||||
{
|
{
|
||||||
bdp->end_vcol = bdp->start_vcol;
|
bdp->end_vcol = bdp->start_vcol;
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
bdp->is_short = TRUE;
|
bdp->is_short = TRUE;
|
||||||
#endif
|
|
||||||
if (!is_del || oap->op_type == OP_APPEND)
|
if (!is_del || oap->op_type == OP_APPEND)
|
||||||
bdp->endspaces = oap->end_vcol - oap->start_vcol + 1;
|
bdp->endspaces = oap->end_vcol - oap->start_vcol + 1;
|
||||||
}
|
}
|
||||||
@@ -5468,9 +5442,7 @@ block_prep(
|
|||||||
bdp->end_vcol = bdp->start_vcol;
|
bdp->end_vcol = bdp->start_vcol;
|
||||||
if (bdp->end_vcol > oap->end_vcol) /* it's all in one character */
|
if (bdp->end_vcol > oap->end_vcol) /* it's all in one character */
|
||||||
{
|
{
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
bdp->is_oneChar = TRUE;
|
bdp->is_oneChar = TRUE;
|
||||||
#endif
|
|
||||||
if (oap->op_type == OP_INSERT)
|
if (oap->op_type == OP_INSERT)
|
||||||
bdp->endspaces = bdp->start_char_vcols - bdp->startspaces;
|
bdp->endspaces = bdp->start_char_vcols - bdp->startspaces;
|
||||||
else if (oap->op_type == OP_APPEND)
|
else if (oap->op_type == OP_APPEND)
|
||||||
@@ -5507,9 +5479,7 @@ block_prep(
|
|||||||
|| oap->op_type == OP_APPEND
|
|| oap->op_type == OP_APPEND
|
||||||
|| oap->op_type == OP_REPLACE)) /* line too short */
|
|| oap->op_type == OP_REPLACE)) /* line too short */
|
||||||
{
|
{
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
bdp->is_short = TRUE;
|
bdp->is_short = TRUE;
|
||||||
#endif
|
|
||||||
/* Alternative: include spaces to fill up the block.
|
/* Alternative: include spaces to fill up the block.
|
||||||
* Disadvantage: can lead to trailing spaces when the line is
|
* Disadvantage: can lead to trailing spaces when the line is
|
||||||
* short where the text is put */
|
* short where the text is put */
|
||||||
@@ -5531,9 +5501,7 @@ block_prep(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
bdp->end_char_vcols = incr;
|
bdp->end_char_vcols = incr;
|
||||||
#endif
|
|
||||||
if (is_del && bdp->startspaces)
|
if (is_del && bdp->startspaces)
|
||||||
pstart = prev_pstart;
|
pstart = prev_pstart;
|
||||||
bdp->textlen = (int)(pend - 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
|
void
|
||||||
clip_get_selection(VimClipboard *cbd)
|
clip_get_selection(VimClipboard *cbd)
|
||||||
|
@@ -709,11 +709,7 @@ static char *(features[]) =
|
|||||||
"-virtualedit",
|
"-virtualedit",
|
||||||
#endif
|
#endif
|
||||||
"+visual",
|
"+visual",
|
||||||
#ifdef FEAT_VISUALEXTRA
|
|
||||||
"+visualextra",
|
"+visualextra",
|
||||||
#else
|
|
||||||
"-visualextra",
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_VIMINFO
|
#ifdef FEAT_VIMINFO
|
||||||
"+viminfo",
|
"+viminfo",
|
||||||
#else
|
#else
|
||||||
@@ -799,6 +795,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
719,
|
||||||
/**/
|
/**/
|
||||||
718,
|
718,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user