vim-patch:7.4.212

Problem:    Now that the +visual feature is always enabled the #ifdefs for it
            are not useful.
Solution:   Remove the checks for FEAT_VISUAL.
f7ff6e85e8
This commit is contained in:
zeertzjq 2022-07-06 13:25:22 +08:00
parent 93c8fe77cb
commit 1b5f53ca95
4 changed files with 19 additions and 36 deletions

View File

@ -7935,13 +7935,8 @@ static bool ins_esc(long *count, int cmdchar, bool nomove)
* Don't do it for CTRL-O, unless past the end of the line. * Don't do it for CTRL-O, unless past the end of the line.
*/ */
if (!nomove if (!nomove
&& (curwin->w_cursor.col != 0 && (curwin->w_cursor.col != 0 || curwin->w_cursor.coladd > 0)
|| curwin->w_cursor.coladd > 0 && (restart_edit == NUL || (gchar_cursor() == NUL && !VIsual_active))
)
&& (restart_edit == NUL
|| (gchar_cursor() == NUL
&& !VIsual_active
))
&& !revins_on) { && !revins_on) {
if (curwin->w_cursor.coladd > 0 || get_ve_flags() == VE_ALL) { if (curwin->w_cursor.coladd > 0 || get_ve_flags() == VE_ALL) {
oneleft(); oneleft();

View File

@ -2078,8 +2078,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
} else if ((mod_mask & MOD_MASK_SHIFT)) { } else if ((mod_mask & MOD_MASK_SHIFT)) {
// Shift-Mouse click searches for the next occurrence of the word under // Shift-Mouse click searches for the next occurrence of the word under
// the mouse pointer // the mouse pointer
if (State & MODE_INSERT if (State & MODE_INSERT || (VIsual_active && VIsual_select)) {
|| (VIsual_active && VIsual_select)) {
stuffcharReadbuff(Ctrl_O); stuffcharReadbuff(Ctrl_O);
} }
if (which_button == MOUSE_LEFT) { if (which_button == MOUSE_LEFT) {
@ -2546,8 +2545,7 @@ static bool checkclearop(oparg_T *oap)
/// @return true if operator or Visual was active. /// @return true if operator or Visual was active.
static bool checkclearopq(oparg_T *oap) static bool checkclearopq(oparg_T *oap)
{ {
if (oap->op_type == OP_NOP if (oap->op_type == OP_NOP && !VIsual_active) {
&& !VIsual_active) {
return false; return false;
} }
clearopbeep(oap); clearopbeep(oap);
@ -4472,7 +4470,6 @@ static void nv_scroll(cmdarg_T *cap)
static void nv_right(cmdarg_T *cap) static void nv_right(cmdarg_T *cap)
{ {
long n; long n;
int PAST_LINE;
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) { if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
// <C-Right> and <S-Right> move a word or WORD right // <C-Right> and <S-Right> move a word or WORD right
@ -4485,18 +4482,17 @@ static void nv_right(cmdarg_T *cap)
cap->oap->motion_type = kMTCharWise; cap->oap->motion_type = kMTCharWise;
cap->oap->inclusive = false; cap->oap->inclusive = false;
PAST_LINE = (VIsual_active && *p_sel != 'o'); bool past_line = (VIsual_active && *p_sel != 'o');
// In virtual mode, there's no such thing as "PAST_LINE", as lines are // In virtual edit mode, there's no such thing as "past_line", as lines
// (theoretically) infinitely long. // are (theoretically) infinitely long.
if (virtual_active()) { if (virtual_active()) {
PAST_LINE = 0; past_line = false;
} }
for (n = cap->count1; n > 0; n--) { for (n = cap->count1; n > 0; n--) {
if ((!PAST_LINE && oneright() == false) if ((!past_line && oneright() == false)
|| (PAST_LINE || (past_line && *get_cursor_pos_ptr() == NUL)) {
&& *get_cursor_pos_ptr() == NUL)) {
// <Space> wraps to next line if 'whichwrap' has 's'. // <Space> wraps to next line if 'whichwrap' has 's'.
// 'l' wraps to next line if 'whichwrap' has 'l'. // 'l' wraps to next line if 'whichwrap' has 'l'.
// CURS_RIGHT wraps to next line if 'whichwrap' has '>'. // CURS_RIGHT wraps to next line if 'whichwrap' has '>'.
@ -4531,7 +4527,7 @@ static void nv_right(cmdarg_T *cap)
} }
} }
break; break;
} else if (PAST_LINE) { } else if (past_line) {
curwin->w_set_curswant = true; curwin->w_set_curswant = true;
if (virtual_active()) { if (virtual_active()) {
oneright(); oneright();
@ -6472,8 +6468,7 @@ static void nv_redo_or_register(cmdarg_T *cap)
static void nv_Undo(cmdarg_T *cap) static void nv_Undo(cmdarg_T *cap)
{ {
// In Visual mode and typing "gUU" triggers an operator // In Visual mode and typing "gUU" triggers an operator
if (cap->oap->op_type == OP_UPPER if (cap->oap->op_type == OP_UPPER || VIsual_active) {
|| VIsual_active) {
// translate "gUU" to "gUgU" // translate "gUU" to "gUgU"
cap->cmdchar = 'g'; cap->cmdchar = 'g';
cap->nchar = 'U'; cap->nchar = 'U';
@ -6488,9 +6483,7 @@ static void nv_Undo(cmdarg_T *cap)
/// single character. /// single character.
static void nv_tilde(cmdarg_T *cap) static void nv_tilde(cmdarg_T *cap)
{ {
if (!p_to if (!p_to && !VIsual_active && cap->oap->op_type != OP_TILDE) {
&& !VIsual_active
&& cap->oap->op_type != OP_TILDE) {
if (bt_prompt(curbuf) && !prompt_curpos_editable()) { if (bt_prompt(curbuf) && !prompt_curpos_editable()) {
clearopbeep(cap->oap); clearopbeep(cap->oap);
return; return;

View File

@ -6627,9 +6627,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
switch (oap->op_type) { switch (oap->op_type) {
case OP_LSHIFT: case OP_LSHIFT:
case OP_RSHIFT: case OP_RSHIFT:
op_shift(oap, true, op_shift(oap, true, oap->is_VIsual ? (int)cap->count1 : 1);
oap->is_VIsual ? (int)cap->count1 :
1);
auto_format(false, true); auto_format(false, true);
break; break;

View File

@ -514,7 +514,7 @@ void last_pat_prog(regmmatch_T *regmatch)
--emsg_off; --emsg_off;
} }
/// lowest level search function. /// Lowest level search function.
/// Search for 'count'th occurrence of pattern "pat" in direction "dir". /// Search for 'count'th occurrence of pattern "pat" in direction "dir".
/// Start at position "pos" and return the found position in "pos". /// Start at position "pos" and return the found position in "pos".
/// ///
@ -3991,8 +3991,7 @@ static int find_prev_quote(char_u *line, int col_start, int quotechar, char_u *e
} }
if (n & 1) { if (n & 1) {
col_start -= n; // uneven number of escape chars, skip it col_start -= n; // uneven number of escape chars, skip it
} else if (line[col_start] == } else if (line[col_start] == quotechar) {
quotechar) {
break; break;
} }
} }
@ -4115,8 +4114,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
col_end = curwin->w_cursor.col; col_end = curwin->w_cursor.col;
} }
} }
} else if (line[col_start] == quotechar } else if (line[col_start] == quotechar || !vis_empty) {
|| !vis_empty) {
int first_col = col_start; int first_col = col_start;
if (!vis_empty) { if (!vis_empty) {
@ -4185,9 +4183,8 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
// Set start position. After vi" another i" must include the ". // Set start position. After vi" another i" must include the ".
// For v2i" include the quotes. // For v2i" include the quotes.
if (!include && count < 2 if (!include && count < 2 && (vis_empty || !inside_quotes)) {
&& (vis_empty || !inside_quotes)) { col_start++;
++col_start;
} }
curwin->w_cursor.col = col_start; curwin->w_cursor.col = col_start;
if (VIsual_active) { if (VIsual_active) {