summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-26 17:28:26 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-26 17:28:26 +0100
commit29ddebef4038d2d2b3bc9d8d3b0109f4046d6fbf (patch)
tree66144403e05268df8594b01d0298db4f570ed60f /src
parent3e460fd8b72db905fbf9f01b00371384ffc415b8 (diff)
patch 8.1.0826: too many #ifdefsv8.1.0826
Problem: Too many #ifdefs. Solution: Graduate FEAT_VIRTUALEDIT. Adds about 10Kbyte to the code.
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c10
-rw-r--r--src/charset.c4
-rw-r--r--src/edit.c55
-rw-r--r--src/eval.c6
-rw-r--r--src/evalfunc.c31
-rw-r--r--src/ex_cmds.c2
-rw-r--r--src/ex_docmd.c6
-rw-r--r--src/feature.h4
-rw-r--r--src/globals.h6
-rw-r--r--src/gui.c2
-rw-r--r--src/if_py_both.h2
-rw-r--r--src/macros.h17
-rw-r--r--src/mark.c12
-rw-r--r--src/mbyte.c10
-rw-r--r--src/memline.c2
-rw-r--r--src/menu.c2
-rw-r--r--src/misc1.c17
-rw-r--r--src/misc2.c33
-rw-r--r--src/move.c11
-rw-r--r--src/netbeans.c4
-rw-r--r--src/normal.c96
-rw-r--r--src/ops.c104
-rw-r--r--src/option.c9
-rw-r--r--src/option.h12
-rw-r--r--src/screen.c22
-rw-r--r--src/search.c12
-rw-r--r--src/spell.c2
-rw-r--r--src/structs.h21
-rw-r--r--src/tag.c2
-rw-r--r--src/ui.c2
-rw-r--r--src/undo.c22
-rw-r--r--src/userfunc.c2
-rw-r--r--src/version.c6
-rw-r--r--src/vim.h6
-rw-r--r--src/window.c4
35 files changed, 65 insertions, 493 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 14152b7737..98d505f18e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1729,9 +1729,7 @@ enter_buffer(buf_T *buf)
/* Cursor on first line by default. */
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
curwin->w_set_curswant = TRUE;
curwin->w_topline_was_set = FALSE;
@@ -2333,9 +2331,7 @@ buflist_getfile(
{
curwin->w_cursor.col = col;
check_cursor_col();
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
curwin->w_set_curswant = TRUE;
}
return OK;
@@ -2363,9 +2359,7 @@ buflist_getfpos(void)
{
curwin->w_cursor.col = fpos->col;
check_cursor_col();
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
curwin->w_set_curswant = TRUE;
}
}
@@ -2958,7 +2952,7 @@ get_winopts(buf_T *buf)
buflist_findfpos(buf_T *buf)
{
wininfo_T *wip;
- static pos_T no_position = INIT_POS_T(1, 0, 0);
+ static pos_T no_position = {1, 0, 0};
wip = find_wininfo(buf, FALSE);
if (wip != NULL)
@@ -3955,9 +3949,7 @@ build_stl_str_hl(
// Line may have changed since checking the cursor column, or the lnum
// was adjusted above.
wp->w_cursor.col = (colnr_T)len;
-#ifdef FEAT_VIRTUALEDIT
wp->w_cursor.coladd = 0;
-#endif
byteval = 0;
}
else
diff --git a/src/charset.c b/src/charset.c
index c1ca3f97c7..5b091ec4d1 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1365,17 +1365,14 @@ getvcol_nolist(pos_T *posp)
colnr_T vcol;
curwin->w_p_list = FALSE;
-#ifdef FEAT_VIRTUALEDIT
if (posp->coladd)
getvvcol(curwin, posp, NULL, &vcol, NULL);
else
-#endif
getvcol(curwin, posp, NULL, &vcol, NULL);
curwin->w_p_list = list_save;
return vcol;
}
-#if defined(FEAT_VIRTUALEDIT) || defined(PROTO)
/*
* Get virtual column in virtual mode.
*/
@@ -1425,7 +1422,6 @@ getvvcol(
else
getvcol(wp, pos, start, cursor, end);
}
-#endif
/*
* Get the leftmost and rightmost virtual column of pos1 and pos2.
diff --git a/src/edit.c b/src/edit.c
index f797d7f04e..de5adcb197 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1072,14 +1072,12 @@ doESCkey:
break;
ins_ctrl_o();
-#ifdef FEAT_VIRTUALEDIT
/* don't move the cursor left when 'virtualedit' has "onemore". */
if (ve_flags & VE_ONEMORE)
{
ins_at_eol = FALSE;
nomove = TRUE;
}
-#endif
count = 0;
goto doESCkey;
@@ -7125,14 +7123,12 @@ stop_insert(
{
if (gchar_cursor() != NUL)
inc_cursor();
-#ifdef FEAT_VIRTUALEDIT
- /* If the cursor is still at the same character, also keep
- * the "coladd". */
+ // If the cursor is still at the same character, also keep
+ // the "coladd".
if (gchar_cursor() == NUL
&& curwin->w_cursor.lnum == tpos.lnum
&& curwin->w_cursor.col == tpos.col)
curwin->w_cursor.coladd = tpos.coladd;
-#endif
}
}
@@ -7182,9 +7178,7 @@ stop_insert(
if (VIsual.col > len)
{
VIsual.col = len;
-#ifdef FEAT_VIRTUALEDIT
VIsual.coladd = 0;
-#endif
}
}
}
@@ -7293,9 +7287,7 @@ beginline(int flags)
else
{
curwin->w_cursor.col = 0;
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
if (flags & (BL_WHITE | BL_SOL))
{
@@ -7323,7 +7315,6 @@ oneright(void)
char_u *ptr;
int l;
-#ifdef FEAT_VIRTUALEDIT
if (virtual_active())
{
pos_T prevpos = curwin->w_cursor;
@@ -7338,7 +7329,6 @@ oneright(void)
return (prevpos.col != curwin->w_cursor.col
|| prevpos.coladd != curwin->w_cursor.coladd) ? OK : FAIL;
}
-#endif
ptr = ml_get_cursor();
if (*ptr == NUL)
@@ -7351,11 +7341,7 @@ oneright(void)
/* move "l" bytes right, but don't end up on the NUL, unless 'virtualedit'
* contains "onemore". */
- if (ptr[l] == NUL
-#ifdef FEAT_VIRTUALEDIT
- && (ve_flags & VE_ONEMORE) == 0
-#endif
- )
+ if (ptr[l] == NUL && (ve_flags & VE_ONEMORE) == 0)
return FAIL;
curwin->w_cursor.col += l;
@@ -7366,18 +7352,17 @@ oneright(void)
int
oneleft(void)
{
-#ifdef FEAT_VIRTUALEDIT
if (virtual_active())
{
-# ifdef FEAT_LINEBREAK
+#ifdef FEAT_LINEBREAK
int width;
-# endif
+#endif
int v = getviscol();
if (v == 0)
return FAIL;
-# ifdef FEAT_LINEBREAK
+#ifdef FEAT_LINEBREAK
/* We might get stuck on 'showbreak', skip over it. */
width = 1;
for (;;)
@@ -7391,9 +7376,9 @@ oneleft(void)
break;
++width;
}
-# else
+#else
coladvance(v - 1);
-# endif
+#endif
if (curwin->w_cursor.coladd == 1)
{
@@ -7409,7 +7394,6 @@ oneleft(void)
curwin->w_set_curswant = TRUE;
return OK;
}
-#endif
if (curwin->w_cursor.col == 0)
return FAIL;
@@ -8665,10 +8649,7 @@ ins_esc(
*/
if (!nomove
&& (curwin->w_cursor.col != 0
-#ifdef FEAT_VIRTUALEDIT
- || curwin->w_cursor.coladd > 0
-#endif
- )
+ || curwin->w_cursor.coladd > 0)
&& (restart_edit == NUL
|| (gchar_cursor() == NUL && !VIsual_active))
#ifdef FEAT_RIGHTLEFT
@@ -8676,7 +8657,6 @@ ins_esc(
#endif
)
{
-#ifdef FEAT_VIRTUALEDIT
if (curwin->w_cursor.coladd > 0 || ve_flags == VE_ALL)
{
oneleft();
@@ -8684,7 +8664,6 @@ ins_esc(
++curwin->w_cursor.coladd;
}
else
-#endif
{
--curwin->w_cursor.col;
/* Correct cursor for multi-byte character. */
@@ -8874,11 +8853,9 @@ ins_ctrl_o(void)
restart_edit = 'R';
else
restart_edit = 'I';
-#ifdef FEAT_VIRTUALEDIT
if (virtual_active())
ins_at_eol = FALSE; /* cursor always keeps its column */
else
-#endif
ins_at_eol = (gchar_cursor() == NUL);
}
@@ -9040,7 +9017,6 @@ ins_bs(
inc_cursor();
#endif
-#ifdef FEAT_VIRTUALEDIT
/* Virtualedit:
* BACKSPACE_CHAR eats a virtual space
* BACKSPACE_WORD eats all coladd
@@ -9060,7 +9036,6 @@ ins_bs(
}
curwin->w_cursor.coladd = 0;
}
-#endif
/*
* Delete newline!
@@ -9744,9 +9719,7 @@ ins_home(int c)
if (c == K_C_HOME)
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
curwin->w_curswant = 0;
start_arrow(&tpos);
}
@@ -9797,21 +9770,15 @@ ins_right(
foldOpenCursor();
#endif
undisplay_dollar();
- if (gchar_cursor() != NUL
-#ifdef FEAT_VIRTUALEDIT
- || virtual_active()
-#endif
- )
+ if (gchar_cursor() != NUL || virtual_active())
{
start_arrow_with_change(&curwin->w_cursor, end_change);
if (!end_change)
AppendCharToRedobuff(K_RIGHT);
curwin->w_set_curswant = TRUE;
-#ifdef FEAT_VIRTUALEDIT
if (virtual_active())
oneright();
else
-#endif
{
if (has_mbyte)
curwin->w_cursor.col += (*mb_ptr2len)(ml_get_cursor());
@@ -10268,12 +10235,10 @@ ins_eol(int c)
* in open_line().
*/
-#ifdef FEAT_VIRTUALEDIT
/* Put cursor on NUL if on the last char and coladd is 1 (happens after
* CTRL-O). */
if (virtual_active() && curwin->w_cursor.coladd > 0)
coladvance(getviscol());
-#endif
#ifdef FEAT_RIGHTLEFT
# ifdef FEAT_FKMAP
diff --git a/src/eval.c b/src/eval.c
index 82de63e1f8..3f9db7d16f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -6207,12 +6207,10 @@ var2fpos(
return NULL; /* invalid column number */
--pos.col;
-#ifdef FEAT_VIRTUALEDIT
/* Get the virtual offset. Defaults to zero. */
pos.coladd = list_find_nr(l, 2L, &error);
if (error)
pos.coladd = 0;
-#endif
return &pos;
}
@@ -6236,9 +6234,7 @@ var2fpos(
return pp;
}
-#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
-#endif
if (name[0] == 'w' && dollar_lnum)
{
@@ -6323,13 +6319,11 @@ list2fpos(
return FAIL;
posp->col = n;
-#ifdef FEAT_VIRTUALEDIT
n = list_find_nr(l, i, NULL); /* off */
if (n < 0)
posp->coladd = 0;
else
posp->coladd = n;
-#endif
if (curswantp != NULL)
*curswantp = list_find_nr(l, i + 1, NULL); /* curswant */
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 269423f929..874e3a66da 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -2517,7 +2517,6 @@ f_col(typval_T *argvars, typval_T *rettv)
else
{
col = fp->col + 1;
-#ifdef FEAT_VIRTUALEDIT
/* col(".") when the cursor is on the NUL at the end of the line
* because of "coladd" can be seen as an extra column. */
if (virtual_active() && fp == &curwin->w_cursor)
@@ -2533,7 +2532,6 @@ f_col(typval_T *argvars, typval_T *rettv)
col += l;
}
}
-#endif
}
}
rettv->vval.v_number = col;
@@ -2838,9 +2836,7 @@ f_cscope_connection(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
f_cursor(typval_T *argvars, typval_T *rettv)
{
long line, col;
-#ifdef FEAT_VIRTUALEDIT
long coladd = 0;
-#endif
int set_curswant = TRUE;
rettv->vval.v_number = -1;
@@ -2856,9 +2852,7 @@ f_cursor(typval_T *argvars, typval_T *rettv)
}
line = pos.lnum;
col = pos.col;
-#ifdef FEAT_VIRTUALEDIT
coladd = pos.coladd;
-#endif
if (curswant >= 0)
{
curwin->w_curswant = curswant - 1;
@@ -2869,24 +2863,16 @@ f_cursor(typval_T *argvars, typval_T *rettv)
{
line = tv_get_lnum(argvars);
col = (long)tv_get_number_chk(&argvars[1], NULL);
-#ifdef FEAT_VIRTUALEDIT
if (argvars[2].v_type != VAR_UNKNOWN)
coladd = (long)tv_get_number_chk(&argvars[2], NULL);
-#endif
}
- if (line < 0 || col < 0
-#ifdef FEAT_VIRTUALEDIT
- || coladd < 0
-#endif
- )
+ if (line < 0 || col < 0 || coladd < 0)
return; /* type error; errmsg already given */
if (line > 0)
curwin->w_cursor.lnum = line;
if (col > 0)
curwin->w_cursor.col = col - 1;
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = coladd;
-#endif
/* Make sure the cursor is in a valid position. */
check_cursor();
@@ -4810,9 +4796,7 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
return;
dict_add_number(d, "lnum", (long)buf->b_changelist[i].lnum);
dict_add_number(d, "col", (long)buf->b_changelist[i].col);
-# ifdef FEAT_VIRTUALEDIT
dict_add_number(d, "coladd", (long)buf->b_changelist[i].coladd);
-# endif
}
#endif
}
@@ -5304,9 +5288,7 @@ f_getjumplist(typval_T *argvars, typval_T *rettv)
return;
dict_add_number(d, "lnum", (long)wp->w_jumplist[i].fmark.mark.lnum);
dict_add_number(d, "col", (long)wp->w_jumplist[i].fmark.mark.col);
-# ifdef FEAT_VIRTUALEDIT
dict_add_number(d, "coladd", (long)wp->w_jumplist[i].fmark.mark.coladd);
-# endif
dict_add_number(d, "bufnr", (long)wp->w_jumplist[i].fmark.fnum);
if (wp->w_jumplist[i].fname != NULL)
dict_add_string(d, "filename", wp->w_jumplist[i].fname);
@@ -5483,10 +5465,7 @@ getpos_both(
list_append_number(l, (fp != NULL)
? (varnumber_T)(fp->col == MAXCOL ? MAXCOL : fp->col + 1)
: (varnumber_T)0);
- list_append_number(l,
-#ifdef FEAT_VIRTUALEDIT
- (fp != NULL) ? (varnumber_T)fp->coladd :
-#endif
+ list_append_number(l, (fp != NULL) ? (varnumber_T)fp->coladd :
(varnumber_T)0);
if (getcurpos)
{
@@ -6574,9 +6553,7 @@ f_has(typval_T *argvars, typval_T *rettv)
"viminfo",
#endif
"vertsplit",
-#ifdef FEAT_VIRTUALEDIT
"virtualedit",
-#endif
"visual",
"visualextra",
"vreplace",
@@ -14611,10 +14588,8 @@ f_winrestview(typval_T *argvars, typval_T *rettv UNUSED)
curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, (char_u *)"lnum");
if (dict_find(dict, (char_u *)"col", -1) != NULL)
curwin->w_cursor.col = (colnr_T)dict_get_number(dict, (char_u *)"col");
-#ifdef FEAT_VIRTUALEDIT
if (dict_find(dict, (char_u *)"coladd", -1) != NULL)
curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, (char_u *)"coladd");
-#endif
if (dict_find(dict, (char_u *)"curswant", -1) != NULL)
{
curwin->w_curswant = (colnr_T)dict_get_number(dict, (char_u *)"curswant");
@@ -14661,9 +14636,7 @@ f_winsaveview(typval_T *argvars UNUSED, typval_T *rettv)
dict_add_number(dict, "lnum", (long)curwin->w_cursor.lnum);
dict_add_number(dict, "col", (long)curwin->w_cursor.col);
-#ifdef FEAT_VIRTUALEDIT
dict_add_number(dict, "coladd", (long)curwin->w_cursor.coladd);
-#endif
update_curswant();
dict_add_number(dict, "curswant", (long)curwin->w_curswant);
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index a4e7cfb2a3..6d03d88ca7 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4332,9 +4332,7 @@ do_ecmd(
/* 'sol' is off: Use last known column. */
curwin->w_cursor.col = solcol;
check_cursor_col();
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
curwin->w_set_curswant = TRUE;
}
else
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index fc86f9eab7..93fa697317 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4650,9 +4650,7 @@ get_address(
pos.col = MAXCOL;
else
pos.col = 0;
-#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
-#endif
if (searchit(curwin, curbuf, &pos, NULL,
*cmd == '?' ? BACKWARD : FORWARD,
(char_u *)"", 1L, SEARCH_MSG,
@@ -9421,9 +9419,7 @@ ex_operators(exarg_T *eap)
oa.end.lnum = eap->line2;
oa.line_count = eap->line2 - eap->line1 + 1;
oa.motion_type = MLINE;
-#ifdef FEAT_VIRTUALEDIT
virtual_op = FALSE;
-#endif
if (eap->cmdidx != CMD_yank) /* position cursor for undo */
{
setpcmark();
@@ -9460,9 +9456,7 @@ ex_operators(exarg_T *eap)
op_shift(&oa, FALSE, eap->amount);
break;
}
-#ifdef FEAT_VIRTUALEDIT
virtual_op = MAYBE;
-#endif
ex_may_print(eap);
}
diff --git a/src/feature.h b/src/feature.h
index e2f9e2a004..a41e79f6f2 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -199,10 +199,8 @@
/*
* +virtualedit 'virtualedit' option and its implementation
+ * Now always included.
*/
-#ifdef FEAT_NORMAL
-# define FEAT_VIRTUALEDIT
-#endif
/*
* +cmdline_info 'showcmd' and 'ruler' options.
diff --git a/src/globals.h b/src/globals.h
index c6fd710f17..0562610fd0 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -771,7 +771,7 @@ EXTERN int can_si_back INIT(= FALSE);
EXTERN pos_T saved_cursor /* w_cursor before formatting text. */
#ifdef DO_INIT
- = INIT_POS_T(0, 0, 0)
+ = {0, 0, 0}
#endif
;
@@ -1066,7 +1066,7 @@ EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold t'gerd */
EXTERN pos_T last_cursormoved /* for CursorMoved event */
# ifdef DO_INIT
- = INIT_POS_T(0, 0, 0)
+ = {0, 0, 0}
# endif
;
@@ -1335,11 +1335,9 @@ EXTERN char psepcN INIT(= '/'); /* abnormal path separator character */
EXTERN char pseps[2] INIT(= {'\\' COMMA 0});
#endif
-#ifdef FEAT_VIRTUALEDIT
/* Set to TRUE when an operator is being executed with virtual editing, MAYBE
* when no operator is being executed, FALSE otherwise. */
EXTERN int virtual_op INIT(= MAYBE);
-#endif
#ifdef FEAT_SYN_HL
/* Display tick, incremented for each call to update_screen() */
diff --git a/src/gui.c b/src/gui.c
index cbbe2af5cb..c22f47716b 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -4599,14 +4599,12 @@ gui_update_horiz_scrollbar(int force)
longest_lnum = gui_find_longest_lnum();
max = scroll_line_len(longest_lnum);
-#ifdef FEAT_VIRTUALEDIT
if (virtual_active())
{
/* May move the cursor even further to the right. */
if (curwin->w_virtcol >= (colnr_T)max)
max = curwin->w_virtcol;
}
-#endif
#ifndef SCROLL_PAST_END
max += curwin->w_width - 1;
diff --git a/src/if_py_both.h b/src/if_py_both.h
index f15bdc366e..a0c1663784 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -4033,9 +4033,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
self->win->w_cursor.lnum = lnum;
self->win->w_cursor.col = col;
self->win->w_set_curswant = TRUE;
-#ifdef FEAT_VIRTUALEDIT
self->win->w_cursor.coladd = 0;
-#endif
/* When column is out of range silently correct it. */
check_cursor_col_win(self->win);
diff --git a/src/macros.h b/src/macros.h
index ad243ccec2..29607db179 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -21,27 +21,18 @@
/*
* Position comparisons
*/
-#ifdef FEAT_VIRTUALEDIT
-# define LT_POS(a, b) (((a).lnum != (b).lnum) \
+#define LT_POS(a, b) (((a).lnum != (b).lnum) \
? (a).lnum < (b).lnum \
: (a).col != (b).col \
? (a).col < (b).col \
: (a).coladd < (b).coladd)
-# define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \
+#define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \
? (a)->lnum < (b)->lnum \
: (a)->col != (b)->col \
? (a)->col < (b)->col \
: (a)->coladd < (b)->coladd)
-# define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd))
-# define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;}
-#else
-# define LT_POS(a, b) (((a).lnum != (b).lnum) \
- ? ((a).lnum < (b).lnum) : ((a).col < (b).col))
-# define LT_POSP(a, b) (((a)->lnum != (b)->lnum) \
- ? ((a)->lnum < (b)->lnum) : ((a)->col < (b)->col))
-# define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col))
-# define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0;}
-#endif
+#define EQUAL_POS(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && ((a).coladd == (b).coladd))
+#define CLEAR_POS(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0;}
#define LTOREQ_POS(a, b) (LT_POS(a, b) || EQUAL_POS(a, b))
diff --git a/src/mark.c b/src/mark.c
index de4b0f97b4..276391743c 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -414,9 +414,7 @@ getmark_buf_fnum(
pos_copy.col = 0;
else
pos_copy.col = MAXCOL;
-#ifdef FEAT_VIRTUALEDIT
pos_copy.coladd = 0;
-#endif
}
}
else if (ASCII_ISLOWER(c)) /* normal named mark */
@@ -651,9 +649,7 @@ clrallmarks(buf_T *buf)
buf->b_op_end.lnum = 0;
buf->b_last_cursor.lnum = 1; /* '" mark cleared */
buf->b_last_cursor.col = 0;
-#ifdef FEAT_VIRTUALEDIT
buf->b_last_cursor.coladd = 0;
-#endif
buf->b_last_insert.lnum = 0; /* '^ mark cleared */
buf->b_last_change.lnum = 0; /* '. mark cleared */
#ifdef FEAT_JUMPLIST
@@ -1052,7 +1048,7 @@ mark_adjust_internal(
linenr_T *lp;
win_T *win;
tabpage_T *tab;
- static pos_T initpos = INIT_POS_T(1, 0, 0);
+ static pos_T initpos = {1, 0, 0};
if (line2 < line1 && amount_after == 0L) /* nothing to do */
return;
@@ -1451,9 +1447,7 @@ read_viminfo_filemark(vir_T *virp, int force)
fm->fmark.mark.lnum = getdigits(&str);
str = skipwhite(str);
fm->fmark.mark.col = getdigits(&str);
-#ifdef FEAT_VIRTUALEDIT
fm->fmark.mark.coladd = 0;
-#endif
fm->fmark.fnum = 0;
str = skipwhite(str);
vim_free(fm->fname);
@@ -1641,9 +1635,7 @@ handle_viminfo_mark(garray_T *values, int force)
{
fm->fmark.mark.lnum = lnum;
fm->fmark.mark.col = col;
-#ifdef FEAT_VIRTUALEDIT
fm->fmark.mark.coladd = 0;
-#endif
fm->fmark.fnum = 0;
vim_free(fm->fname);
if (vp[4].bv_allocated)
@@ -2146,9 +2138,7 @@ copy_viminfo_marks(
}
vim_free(str);
-#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
-#endif
while (!(eof = viminfo_readline(virp)) && line[0] == TAB)
{
if (load_marks)
diff --git a/src/mbyte.c b/src/mbyte.c
index faeebfd83f..aa10d5e32b 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -3994,9 +3994,7 @@ utf_find_illegal(void)
convert_setup(&vimconv, p_enc, curbuf->b_p_fenc);
}
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
for (;;)
{
p = ml_get_cursor();
@@ -4118,18 +4116,13 @@ mb_adjustpos(buf_T *buf, pos_T *lp)
{
char_u *p;
- if (lp->col > 0
-#ifdef FEAT_VIRTUALEDIT
- || lp->coladd > 1
-#endif
- )
+ if (lp->col > 0 || lp->coladd > 1)
{
p = ml_get_buf(buf, lp->lnum, FALSE);
if (*p == NUL || (int)STRLEN(p) < lp->col)
lp->col = 0;
else
lp->col -= (*mb_head_off)(p, p + lp->col);
-#ifdef FEAT_VIRTUALEDIT
/* Reset "coladd" when the cursor would be on the right half of a
* double-wide character. */
if (lp->coladd == 1
@@ -4137,7 +4130,6 @@ mb_adjustpos(buf_T *buf, pos_T *lp)
&& vim_isprintc((*mb_ptr2char)(p + lp->col))
&& ptr2cells(p + lp->col) > 1)
lp->coladd = 0;
-#endif
}
}
diff --git a/src/memline.c b/src/memline.c
index f99344bd4d..c62ea5f60c 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -5667,9 +5667,7 @@ goto_byte(long cnt)
{
curwin->w_cursor.lnum = lnum;
curwin->w_cursor.col = (colnr_T)boff;
-# ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-# endif
curwin->w_set_curswant = TRUE;
}
check_cursor();
diff --git a/src/menu.c b/src/menu.c
index a9cbb05d02..085d0e79ca 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -2318,9 +2318,7 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx)
curwin->w_cursor.col = 1;
tpos.lnum = eap->line2;
tpos.col = MAXCOL;
-#ifdef FEAT_VIRTUALEDIT
tpos.coladd = 0;
-#endif
}
/* Activate visual mode */
diff --git a/src/misc1.c b/src/misc1.c
index 0c38c8af53..1db7496c07 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -622,9 +622,7 @@ get_number_indent(linenr_T lnum)
{
pos.lnum = lnum;
pos.col = (colnr_T)(*regmatch.endp - ml_get(lnum));
-#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
-#endif
}
vim_regfree(regmatch.regprog);
}
@@ -1708,9 +1706,7 @@ open_line(
changed_lines(curwin->w_cursor.lnum, 0, curwin->w_cursor.lnum, 1L);
curwin->w_cursor.col = newcol;
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
/*
@@ -1781,9 +1777,7 @@ open_line(
/* Insert new stuff into line again */
curwin->w_cursor.col = 0;
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
ins_bytes(p_extra); /* will call changed_bytes() */
vim_free(p_extra);
next_line = NULL;
@@ -2354,11 +2348,9 @@ ins_char_bytes(char_u *buf, int charlen)
linenr_T lnum = curwin->w_cursor.lnum;
int i;
-#ifdef FEAT_VIRTUALEDIT
/* Break tabs if needed. */
if (virtual_active() && curwin->w_cursor.coladd > 0)
coladvance_force(getviscol());
-#endif
col = curwin->w_cursor.col;
oldp = ml_get(lnum);
@@ -2499,10 +2491,8 @@ ins_str(char_u *s)
colnr_T col;
linenr_T lnum = curwin->w_cursor.lnum;
-#ifdef FEAT_VIRTUALEDIT
if (virtual_active() && curwin->w_cursor.coladd > 0)
coladvance_force(getviscol());
-#endif
col = curwin->w_cursor.col;
oldp = ml_get(lnum);
@@ -2637,15 +2627,10 @@ del_bytes(
* unless "restart_edit" is set or 'virtualedit' contains "onemore".
*/
if (col > 0 && fixpos && restart_edit == 0
-#ifdef FEAT_VIRTUALEDIT
- && (ve_flags & VE_ONEMORE) == 0
-#endif
- )
+ && (ve_flags & VE_ONEMORE) == 0)
{
--curwin->w_cursor.col;
-#ifdef FEAT_VIRTUALEDIT
curwin->w_cursor.coladd = 0;
-#endif
if (has_mbyte)
curwin->w_cursor.col -=
(*mb_head_off)(oldp, oldp + curwin->w_cursor.col);
diff --git a/src/misc2.c b/src/misc2.c
index 1f5f752690..ca8f56d384 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -16,7 +16,6 @@ static char_u *username = NULL; /* cached result of mch_get_user_name() */
static char_u *ff_expand_buf