mirror of
https://github.com/zoriya/vim.git
synced 2025-12-20 06:05:18 +00:00
patch 8.1.0226: too many #ifdefs
Problem: Too many #ifdefs.
Solution: Graduate the +vreplace feature, it's not much code and quite a few
#ifdefs.
This commit is contained in:
@@ -177,8 +177,6 @@ gR Enter Virtual Replace mode: Each character you type
|
||||
<Tab> may replace several characters at once.
|
||||
Repeat the entered text [count]-1 times. See
|
||||
|Virtual-Replace-mode| for more details.
|
||||
{not available when compiled without the |+vreplace|
|
||||
feature}
|
||||
|
||||
*c*
|
||||
["x]c{motion} Delete {motion} text [into register x] and start
|
||||
@@ -303,8 +301,6 @@ gr{char} Replace the virtual characters under the cursor with
|
||||
space. See |gR| and |Virtual-Replace-mode| for more
|
||||
details. As with |r| a count may be given.
|
||||
{char} can be entered like with |r|.
|
||||
{not available when compiled without the |+vreplace|
|
||||
feature}
|
||||
|
||||
*digraph-arg*
|
||||
The argument for Normal mode commands like |r| and |t| is a single character.
|
||||
|
||||
@@ -461,7 +461,7 @@ N *+viminfo* |'viminfo'|
|
||||
N *+virtualedit* |'virtualedit'|
|
||||
S *+visual* Visual mode |Visual-mode| Always enabled since 7.4.200.
|
||||
N *+visualextra* extra Visual mode commands |blockwise-operators|
|
||||
N *+vreplace* |gR| and |gr|
|
||||
T *+vreplace* |gR| and |gr|
|
||||
*+vtp* on MS-Windows console: support for 'termguicolors'
|
||||
N *+wildignore* |'wildignore'|
|
||||
N *+wildmenu* |'wildmenu'|
|
||||
|
||||
87
src/edit.c
87
src/edit.c
@@ -463,7 +463,6 @@ edit(
|
||||
{
|
||||
ResetRedobuff();
|
||||
AppendNumberToRedobuff(count);
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (cmdchar == 'V' || cmdchar == 'v')
|
||||
{
|
||||
/* "gR" or "gr" command */
|
||||
@@ -471,7 +470,6 @@ edit(
|
||||
AppendCharToRedobuff((cmdchar == 'v') ? 'r' : 'R');
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (cmdchar == K_PS)
|
||||
AppendCharToRedobuff('a');
|
||||
@@ -497,7 +495,6 @@ edit(
|
||||
#endif
|
||||
State = REPLACE;
|
||||
}
|
||||
#ifdef FEAT_VREPLACE
|
||||
else if (cmdchar == 'V' || cmdchar == 'v')
|
||||
{
|
||||
State = VREPLACE;
|
||||
@@ -505,7 +502,6 @@ edit(
|
||||
orig_line_count = curbuf->b_ml.ml_line_count;
|
||||
vr_lines_changed = 1;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
State = INSERT;
|
||||
|
||||
@@ -2042,7 +2038,6 @@ change_indent(
|
||||
int save_p_list;
|
||||
int start_col;
|
||||
colnr_T vc;
|
||||
#ifdef FEAT_VREPLACE
|
||||
colnr_T orig_col = 0; /* init for GCC */
|
||||
char_u *new_line, *orig_line = NULL; /* init for GCC */
|
||||
|
||||
@@ -2052,7 +2047,6 @@ change_indent(
|
||||
orig_line = vim_strsave(ml_get_curline()); /* Deal with NULL below */
|
||||
orig_col = curwin->w_cursor.col;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* for the following tricks we don't want list mode */
|
||||
save_p_list = curwin->w_p_list;
|
||||
@@ -2091,17 +2085,13 @@ change_indent(
|
||||
(void)set_indent(amount, call_changed_bytes ? SIN_CHANGED : 0);
|
||||
else
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
int save_State = State;
|
||||
|
||||
/* Avoid being called recursively. */
|
||||
if (State & VREPLACE_FLAG)
|
||||
State = INSERT;
|
||||
#endif
|
||||
shift_line(type == INDENT_DEC, round, 1, call_changed_bytes);
|
||||
#ifdef FEAT_VREPLACE
|
||||
State = save_State;
|
||||
#endif
|
||||
}
|
||||
insstart_less -= curwin->w_cursor.col;
|
||||
|
||||
@@ -2233,7 +2223,6 @@ change_indent(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
/*
|
||||
* For VREPLACE mode, we also have to fix the replace stack. In this case
|
||||
* it is always possible because we backspace over the whole line and then
|
||||
@@ -2266,7 +2255,6 @@ change_indent(
|
||||
|
||||
vim_free(new_line);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2288,8 +2276,6 @@ truncate_spaces(char_u *line)
|
||||
line[i + 1] = NUL;
|
||||
}
|
||||
|
||||
#if defined(FEAT_VREPLACE) || defined(FEAT_INS_EXPAND) \
|
||||
|| defined(FEAT_COMMENTS) || defined(PROTO)
|
||||
/*
|
||||
* Backspace the cursor until the given column. Handles REPLACE and VREPLACE
|
||||
* modes correctly. May also be used when not in insert mode at all.
|
||||
@@ -2308,7 +2294,6 @@ backspace_until_column(int col)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Like del_char(), but make sure not to go before column "limit_col".
|
||||
@@ -6224,9 +6209,7 @@ insertchar(
|
||||
&& (force_format
|
||||
|| (!VIM_ISWHITE(c)
|
||||
&& !((State & REPLACE_FLAG)
|
||||
#ifdef FEAT_VREPLACE
|
||||
&& !(State & VREPLACE_FLAG)
|
||||
#endif
|
||||
&& *ml_get_cursor() != NUL)
|
||||
&& (curwin->w_cursor.lnum != Insstart.lnum
|
||||
|| ((!has_format_option(FO_INS_LONG)
|
||||
@@ -6471,11 +6454,7 @@ internal_format(
|
||||
* When 'ai' is off we don't want a space under the cursor to be
|
||||
* deleted. Replace it with an 'x' temporarily.
|
||||
*/
|
||||
if (!curbuf->b_p_ai
|
||||
#ifdef FEAT_VREPLACE
|
||||
&& !(State & VREPLACE_FLAG)
|
||||
#endif
|
||||
)
|
||||
if (!curbuf->b_p_ai && !(State & VREPLACE_FLAG))
|
||||
{
|
||||
cc = gchar_cursor();
|
||||
if (VIM_ISWHITE(cc))
|
||||
@@ -6496,10 +6475,8 @@ internal_format(
|
||||
int end_foundcol = 0; /* column for start of word */
|
||||
colnr_T len;
|
||||
colnr_T virtcol;
|
||||
#ifdef FEAT_VREPLACE
|
||||
int orig_col = 0;
|
||||
char_u *saved_text = NULL;
|
||||
#endif
|
||||
colnr_T col;
|
||||
colnr_T end_col;
|
||||
|
||||
@@ -6669,11 +6646,9 @@ internal_format(
|
||||
* stack functions. VREPLACE does not use this, and backspaces
|
||||
* over the text instead.
|
||||
*/
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
orig_col = startcol; /* Will start backspacing from here */
|
||||
else
|
||||
#endif
|
||||
replace_offset = startcol - end_foundcol;
|
||||
|
||||
/*
|
||||
@@ -6688,7 +6663,6 @@ internal_format(
|
||||
if (startcol < 0)
|
||||
startcol = 0;
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
/*
|
||||
@@ -6706,7 +6680,6 @@ internal_format(
|
||||
backspace_until_column(foundcol);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* put cursor after pos. to break line */
|
||||
if (!fo_white_par)
|
||||
@@ -6744,12 +6717,10 @@ internal_format(
|
||||
get_number_indent(curwin->w_cursor.lnum - 1);
|
||||
if (second_indent >= 0)
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
change_indent(INDENT_SET, second_indent,
|
||||
FALSE, NUL, TRUE);
|
||||
else
|
||||
#endif
|
||||
#ifdef FEAT_COMMENTS
|
||||
if (leader_len > 0 && second_indent - leader_len > 0)
|
||||
{
|
||||
@@ -6778,7 +6749,6 @@ internal_format(
|
||||
first_line = FALSE;
|
||||
}
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
/*
|
||||
@@ -6789,7 +6759,6 @@ internal_format(
|
||||
vim_free(saved_text);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* Check if cursor is not past the NUL off the line, cindent
|
||||
@@ -7140,13 +7109,11 @@ stop_arrow(void)
|
||||
}
|
||||
|
||||
ai_col = 0;
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
orig_line_count = curbuf->b_ml.ml_line_count;
|
||||
vr_lines_changed = 1;
|
||||
}
|
||||
#endif
|
||||
ResetRedobuff();
|
||||
AppendToRedobuff((char_u *)"1i"); /* pretend we start an insertion */
|
||||
new_insert_skip = 2;
|
||||
@@ -7983,7 +7950,6 @@ replace_flush(void)
|
||||
replace_do_bs(int limit_col)
|
||||
{
|
||||
int cc;
|
||||
#ifdef FEAT_VREPLACE
|
||||
int orig_len = 0;
|
||||
int ins_len;
|
||||
int orig_vcols = 0;
|
||||
@@ -7991,12 +7957,10 @@ replace_do_bs(int limit_col)
|
||||
char_u *p;
|
||||
int i;
|
||||
int vcol;
|
||||
#endif
|
||||
|
||||
cc = replace_pop();
|
||||
if (cc > 0)
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
/* Get the number of screen cells used by the character we are
|
||||
@@ -8004,29 +7968,23 @@ replace_do_bs(int limit_col)
|
||||
getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
|
||||
orig_vcols = chartabsize(ml_get_cursor(), start_vcol);
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
{
|
||||
(void)del_char_after_col(limit_col);
|
||||
# ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
orig_len = (int)STRLEN(ml_get_cursor());
|
||||
# endif
|
||||
replace_push(cc);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pchar_cursor(cc);
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
orig_len = (int)STRLEN(ml_get_cursor()) - 1;
|
||||
#endif
|
||||
}
|
||||
replace_pop_ins();
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
/* Get the number of screen cells used by the inserted characters */
|
||||
@@ -8052,7 +8010,6 @@ replace_do_bs(int limit_col)
|
||||
}
|
||||
curwin->w_cursor.col -= ins_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* mark the buffer as changed and prepare for displaying */
|
||||
changed_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col);
|
||||
@@ -8966,11 +8923,9 @@ ins_insert(int replaceState)
|
||||
|
||||
# ifdef FEAT_EVAL
|
||||
set_vim_var_string(VV_INSERTMODE,
|
||||
(char_u *)((State & REPLACE_FLAG) ? "i" :
|
||||
# ifdef FEAT_VREPLACE
|
||||
replaceState == VREPLACE ? "v" :
|
||||
# endif
|
||||
"r"), 1);
|
||||
(char_u *)((State & REPLACE_FLAG) ? "i"
|
||||
: replaceState == VREPLACE ? "v"
|
||||
: "r"), 1);
|
||||
# endif
|
||||
apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf);
|
||||
if (State & REPLACE_FLAG)
|
||||
@@ -8990,11 +8945,9 @@ ins_insert(int replaceState)
|
||||
static void
|
||||
ins_ctrl_o(void)
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
restart_edit = 'V';
|
||||
else
|
||||
#endif
|
||||
if (State & REPLACE_FLAG)
|
||||
restart_edit = 'R';
|
||||
else
|
||||
@@ -9067,14 +9020,12 @@ ins_del(void)
|
||||
else
|
||||
{
|
||||
curwin->w_cursor.col = temp;
|
||||
#ifdef FEAT_VREPLACE
|
||||
/* Adjust orig_line_count in case more lines have been deleted than
|
||||
* have been added. That makes sure, that open_line() later
|
||||
* can access all buffer lines correctly */
|
||||
if (State & VREPLACE_FLAG &&
|
||||
orig_line_count > curbuf->b_ml.ml_line_count)
|
||||
orig_line_count = curbuf->b_ml.ml_line_count;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (del_char(FALSE) == FAIL) /* delete char under cursor */
|
||||
@@ -9229,10 +9180,8 @@ ins_bs(
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (!(State & VREPLACE_FLAG)
|
||||
|| curwin->w_cursor.lnum > orig_line_count)
|
||||
#endif
|
||||
{
|
||||
temp = gchar_cursor(); /* remember current char */
|
||||
--curwin->w_cursor.lnum;
|
||||
@@ -9256,10 +9205,8 @@ ins_bs(
|
||||
if (temp == NUL && gchar_cursor() != NUL)
|
||||
inc_cursor();
|
||||
}
|
||||
#ifdef FEAT_VREPLACE
|
||||
else
|
||||
dec_cursor();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* In REPLACE mode we have to put back the text that was replaced
|
||||
@@ -9386,11 +9333,9 @@ ins_bs(
|
||||
&& curwin->w_cursor.col < Insstart_orig.col)
|
||||
Insstart_orig.col = curwin->w_cursor.col;
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
ins_char(' ');
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ins_str((char_u *)" ");
|
||||
if ((State & REPLACE_FLAG))
|
||||
@@ -10231,11 +10176,9 @@ ins_tab(void)
|
||||
ins_char(' ');
|
||||
while (--temp > 0)
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
ins_char(' ');
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ins_str((char_u *)" ");
|
||||
if (State & REPLACE_FLAG) /* no char replaced */
|
||||
@@ -10255,10 +10198,8 @@ ins_tab(void)
|
||||
#endif
|
||||
{
|
||||
char_u *ptr;
|
||||
#ifdef FEAT_VREPLACE
|
||||
char_u *saved_line = NULL; /* init for GCC */
|
||||
pos_T pos;
|
||||
#endif
|
||||
pos_T fpos;
|
||||
pos_T *cursor;
|
||||
colnr_T want_vcol, vcol;
|
||||
@@ -10269,7 +10210,6 @@ ins_tab(void)
|
||||
* Get the current line. For VREPLACE mode, don't make real changes
|
||||
* yet, just work on a copy of the line.
|
||||
*/
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
pos = curwin->w_cursor;
|
||||
@@ -10280,7 +10220,6 @@ ins_tab(void)
|
||||
ptr = saved_line + pos.col;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
ptr = ml_get_cursor();
|
||||
cursor = &curwin->w_cursor;
|
||||
@@ -10360,11 +10299,7 @@ ins_tab(void)
|
||||
{
|
||||
STRMOVE(ptr, ptr + i);
|
||||
/* correct replace stack. */
|
||||
if ((State & REPLACE_FLAG)
|
||||
#ifdef FEAT_VREPLACE
|
||||
&& !(State & VREPLACE_FLAG)
|
||||
#endif
|
||||
)
|
||||
if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG))
|
||||
for (temp = i; --temp >= 0; )
|
||||
replace_join(repl_off);
|
||||
}
|
||||
@@ -10378,7 +10313,6 @@ ins_tab(void)
|
||||
#endif
|
||||
cursor->col -= i;
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
/*
|
||||
* In VREPLACE mode, we haven't changed anything yet. Do it now by
|
||||
* backspacing over the changed spacing and then inserting the new
|
||||
@@ -10394,13 +10328,10 @@ ins_tab(void)
|
||||
ins_bytes_len(saved_line + change_col,
|
||||
cursor->col - change_col);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
vim_free(saved_line);
|
||||
#endif
|
||||
curwin->w_p_list = save_list;
|
||||
}
|
||||
|
||||
@@ -10427,11 +10358,7 @@ ins_eol(int c)
|
||||
* character under the cursor. Only push a NUL on the replace stack,
|
||||
* nothing to put back when the NL is deleted.
|
||||
*/
|
||||
if ((State & REPLACE_FLAG)
|
||||
#ifdef FEAT_VREPLACE
|
||||
&& !(State & VREPLACE_FLAG)
|
||||
#endif
|
||||
)
|
||||
if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG))
|
||||
replace_push(NUL);
|
||||
|
||||
/*
|
||||
@@ -10700,11 +10627,9 @@ ins_try_si(int c)
|
||||
curwin->w_cursor = *pos;
|
||||
i = get_indent();
|
||||
curwin->w_cursor = old_pos;
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
change_indent(INDENT_SET, i, FALSE, NUL, TRUE);
|
||||
else
|
||||
#endif
|
||||
(void)set_indent(i, SIN_CHANGED);
|
||||
}
|
||||
else if (curwin->w_cursor.col > 0)
|
||||
|
||||
@@ -6450,9 +6450,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
||||
#ifdef FEAT_VISUALEXTRA
|
||||
"visualextra",
|
||||
#endif
|
||||
#ifdef FEAT_VREPLACE
|
||||
"vreplace",
|
||||
#endif
|
||||
#ifdef FEAT_VTP
|
||||
"vtp",
|
||||
#endif
|
||||
@@ -8400,14 +8398,12 @@ f_mode(typval_T *argvars, typval_T *rettv)
|
||||
buf[0] = '!';
|
||||
else if (State & INSERT)
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
buf[0] = 'R';
|
||||
buf[1] = 'v';
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (State & REPLACE_FLAG)
|
||||
buf[0] = 'R';
|
||||
|
||||
@@ -206,13 +206,6 @@
|
||||
# define FEAT_VIRTUALEDIT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* +vreplace "gR" and "gr" commands.
|
||||
*/
|
||||
#ifdef FEAT_NORMAL
|
||||
# define FEAT_VREPLACE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* +cmdline_info 'showcmd' and 'ruler' options.
|
||||
*/
|
||||
|
||||
@@ -778,13 +778,11 @@ EXTERN pos_T Insstart; /* This is where the latest
|
||||
* op_insert(), to detect correctly where inserting by the user started. */
|
||||
EXTERN pos_T Insstart_orig;
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
/*
|
||||
* Stuff for VREPLACE mode.
|
||||
*/
|
||||
EXTERN int orig_line_count INIT(= 0); /* Line count when "gR" started */
|
||||
EXTERN int vr_lines_changed INIT(= 0); /* #Lines changed by "gR" so far */
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
|
||||
/* argument to SETJMP() for handling X IO errors */
|
||||
|
||||
@@ -3181,10 +3181,8 @@ button_set:
|
||||
case SELECTMODE: checkfor = MOUSE_VISUAL; break;
|
||||
case REPLACE:
|
||||
case REPLACE+LANGMAP:
|
||||
# ifdef FEAT_VREPLACE
|
||||
case VREPLACE:
|
||||
case VREPLACE+LANGMAP:
|
||||
# endif
|
||||
case INSERT:
|
||||
case INSERT+LANGMAP: checkfor = MOUSE_INSERT; break;
|
||||
case ASKMORE:
|
||||
|
||||
@@ -235,11 +235,7 @@
|
||||
# define TIME_MSG(s) do { /**/ } while (0)
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
#define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG))
|
||||
#else
|
||||
# define REPLACE_NORMAL(s) ((s) & REPLACE_FLAG)
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_ARABIC
|
||||
# define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2))
|
||||
|
||||
30
src/misc1.c
30
src/misc1.c
@@ -784,10 +784,7 @@ open_line(
|
||||
char_u *leader = NULL; /* copy of comment leader */
|
||||
#endif
|
||||
char_u *allocated = NULL; /* allocated memory */
|
||||
#if defined(FEAT_SMARTINDENT) || defined(FEAT_VREPLACE) || defined(FEAT_LISP) \
|
||||
|| defined(FEAT_CINDENT) || defined(FEAT_COMMENTS)
|
||||
char_u *p;
|
||||
#endif
|
||||
int saved_char = NUL; /* init for GCC */
|
||||
#if defined(FEAT_SMARTINDENT) || defined(FEAT_COMMENTS)
|
||||
pos_T *pos;
|
||||
@@ -804,7 +801,7 @@ open_line(
|
||||
int no_si = FALSE; /* reset did_si afterwards */
|
||||
int first_char = NUL; /* init for GCC */
|
||||
#endif
|
||||
#if defined(FEAT_VREPLACE) && (defined(FEAT_LISP) || defined(FEAT_CINDENT))
|
||||
#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
|
||||
int vreplace_mode;
|
||||
#endif
|
||||
int did_append; /* appended a new line */
|
||||
@@ -817,7 +814,6 @@ open_line(
|
||||
if (saved_line == NULL) /* out of memory! */
|
||||
return FALSE;
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
/*
|
||||
@@ -857,13 +853,8 @@ open_line(
|
||||
}
|
||||
saved_line[curwin->w_cursor.col] = NUL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((State & INSERT)
|
||||
#ifdef FEAT_VREPLACE
|
||||
&& !(State & VREPLACE_FLAG)
|
||||
#endif
|
||||
)
|
||||
if ((State & INSERT) && !(State & VREPLACE_FLAG))
|
||||
{
|
||||
p_extra = saved_line + curwin->w_cursor.col;
|
||||
#ifdef FEAT_SMARTINDENT
|
||||
@@ -1601,9 +1592,7 @@ open_line(
|
||||
old_cursor = curwin->w_cursor;
|
||||
if (dir == BACKWARD)
|
||||
--curwin->w_cursor.lnum;
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (!(State & VREPLACE_FLAG) || old_cursor.lnum >= orig_line_count)
|
||||
#endif
|
||||
{
|
||||
if (ml_append(curwin->w_cursor.lnum, p_extra, (colnr_T)0, FALSE)
|
||||
== FAIL)
|
||||
@@ -1620,7 +1609,6 @@ open_line(
|
||||
mark_adjust(curwin->w_cursor.lnum + 1, (linenr_T)MAXLNUM, 1L, 0L);
|
||||
did_append = TRUE;
|
||||
}
|
||||
#ifdef FEAT_VREPLACE
|
||||
else
|
||||
{
|
||||
/*
|
||||
@@ -1640,7 +1628,6 @@ open_line(
|
||||
curwin->w_cursor.lnum--;
|
||||
did_append = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (newindent
|
||||
#ifdef FEAT_SMARTINDENT
|
||||
@@ -1744,7 +1731,7 @@ open_line(
|
||||
curwin->w_cursor.coladd = 0;
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_VREPLACE) && (defined(FEAT_LISP) || defined(FEAT_CINDENT))
|
||||
#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
|
||||
/*
|
||||
* In VREPLACE mode, we are handling the replace stack ourselves, so stop
|
||||
* fixthisline() from doing it (via change_indent()) by telling it we're in
|
||||
@@ -1791,12 +1778,11 @@ open_line(
|
||||
ai_col = (colnr_T)getwhitecols_curline();
|
||||
}
|
||||
#endif
|
||||
#if defined(FEAT_VREPLACE) && (defined(FEAT_LISP) || defined(FEAT_CINDENT))
|
||||
#if defined(FEAT_LISP) || defined(FEAT_CINDENT)
|
||||
if (vreplace_mode != 0)
|
||||
State = vreplace_mode;
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
/*
|
||||
* Finally, VREPLACE gets the stuff on the new line, then puts back the
|
||||
* original line, and inserts the new stuff char by char, pushing old stuff
|
||||
@@ -1821,7 +1807,6 @@ open_line(
|
||||
vim_free(p_extra);
|
||||
next_line = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
retval = OK; /* success! */
|
||||
theend:
|
||||
@@ -2307,7 +2292,6 @@ plines_m_win(win_T *wp, linenr_T first, linenr_T last)
|
||||
return (count);
|
||||
}
|
||||
|
||||
#if defined(FEAT_VREPLACE) || defined(FEAT_INS_EXPAND) || defined(PROTO)
|
||||
/*
|
||||
* Insert string "p" at the cursor position. Stops at a NUL byte.
|
||||
* Handles Replace mode and multi-byte characters.
|
||||
@@ -2317,10 +2301,7 @@ ins_bytes(char_u *p)
|
||||
{
|
||||
ins_bytes_len(p, (int)STRLEN(p));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_VREPLACE) || defined(FEAT_INS_EXPAND) \
|
||||
|| defined(FEAT_COMMENTS) || defined(FEAT_MBYTE) || defined(PROTO)
|
||||
/*
|
||||
* Insert string "p" with length "len" at the cursor position.
|
||||
* Handles Replace mode and multi-byte characters.
|
||||
@@ -2347,7 +2328,6 @@ ins_bytes_len(char_u *p, int len)
|
||||
for (i = 0; i < len; ++i)
|
||||
ins_char(p[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Insert or replace a single character at the cursor position.
|
||||
@@ -2406,7 +2386,6 @@ ins_char_bytes(char_u *buf, int charlen)
|
||||
|
||||
if (State & REPLACE_FLAG)
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
{
|
||||
colnr_T new_vcol = 0; /* init for GCC */
|
||||
@@ -2456,7 +2435,6 @@ ins_char_bytes(char_u *buf, int charlen)
|
||||
curwin->w_p_list = old_list;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (oldp[col] != NUL)
|
||||
{
|
||||
/* normal replace */
|
||||
|
||||
@@ -3766,10 +3766,8 @@ get_shape_idx(int mouse)
|
||||
#endif
|
||||
if (!mouse && State == SHOWMATCH)
|
||||
return SHAPE_IDX_SM;
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
return SHAPE_IDX_R;
|
||||
#endif
|
||||
if (State & REPLACE_FLAG)
|
||||
return SHAPE_IDX_R;
|
||||
if (State & INSERT)
|
||||
|
||||
@@ -111,9 +111,7 @@ static void nv_findpar(cmdarg_T *cap);
|
||||
static void nv_undo(cmdarg_T *cap);
|
||||
static void nv_kundo(cmdarg_T *cap);
|
||||
static void nv_Replace(cmdarg_T *cap);
|
||||
#ifdef FEAT_VREPLACE
|
||||
static void nv_vreplace(cmdarg_T *cap);
|
||||
#endif
|
||||
static void v_swap_corners(int cmdchar);
|
||||
static void nv_replace(cmdarg_T *cap);
|
||||
static void n_swapchar(cmdarg_T *cap);
|
||||
@@ -7300,7 +7298,6 @@ nv_Replace(cmdarg_T *cap)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
/*
|
||||
* "gr".
|
||||
*/
|
||||
@@ -7331,7 +7328,6 @@ nv_vreplace(cmdarg_T *cap)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Swap case for "~" command, when it does not work like an operator.
|
||||
@@ -7944,7 +7940,6 @@ nv_g_cmd(cmdarg_T *cap)
|
||||
clearopbeep(oap);
|
||||
break;
|
||||
|
||||
#ifdef FEAT_VREPLACE
|
||||
/*
|
||||
* "gR": Enter virtual replace mode.
|
||||
*/
|
||||
@@ -7956,7 +7951,6 @@ nv_g_cmd(cmdarg_T *cap)
|
||||
case 'r':
|
||||
nv_vreplace(cap);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case '&':
|
||||
do_cmdline_cmd((char_u *)"%s//~/&");
|
||||
|
||||
@@ -376,11 +376,9 @@ shift_line(
|
||||
}
|
||||
|
||||
/* Set new indent */
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
change_indent(INDENT_SET, count, FALSE, NUL, call_changed_bytes);
|
||||
else
|
||||
#endif
|
||||
(void)set_indent(count, call_changed_bytes ? SIN_CHANGED : 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -10375,12 +10375,9 @@ showmode(void)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef FEAT_VREPLACE
|
||||
if (State & VREPLACE_FLAG)
|
||||
MSG_PUTS_ATTR(_(" VREPLACE"), attr);
|
||||
else
|
||||
#endif
|
||||
if (State & REPLACE_FLAG)
|
||||
else if (State & REPLACE_FLAG)
|
||||
MSG_PUTS_ATTR(_(" REPLACE"), attr);
|
||||
else if (State & INSERT)
|
||||
{
|
||||
|
||||
@@ -714,11 +714,7 @@ static char *(features[]) =
|
||||
#else
|
||||
"-viminfo",
|
||||
#endif
|
||||
#ifdef FEAT_VREPLACE
|
||||
"+vreplace",
|
||||
#else
|
||||
"-vreplace",
|
||||
#endif
|
||||
#ifdef WIN3264
|
||||
# ifdef FEAT_VTP
|
||||
"+vtp",
|
||||
@@ -798,6 +794,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
226,
|
||||
/**/
|
||||
225,
|
||||
/**/
|
||||
|
||||
@@ -675,10 +675,8 @@ extern int (*dyn_libintl_putenv)(const char *envstring);
|
||||
|
||||
#define REPLACE_FLAG 0x40 /* Replace mode flag */
|
||||
#define REPLACE (REPLACE_FLAG + INSERT)
|
||||
#ifdef FEAT_VREPLACE
|
||||
#define VREPLACE_FLAG 0x80 /* Virtual-replace mode flag */
|
||||
#define VREPLACE (REPLACE_FLAG + VREPLACE_FLAG + INSERT)
|
||||
#endif
|
||||
#define LREPLACE (REPLACE_FLAG + LANGMAP)
|
||||
|
||||
#define NORMAL_BUSY (0x100 + NORMAL) /* Normal mode, busy with a command */
|
||||
|
||||
Reference in New Issue
Block a user