aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/edit.c9
-rw-r--r--src/nvim/normal.c29
-rw-r--r--src/nvim/ops.c4
-rw-r--r--src/nvim/search.c13
4 files changed, 19 insertions, 36 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 06f6d7f97b..de6f2c32de 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -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.
*/
if (!nomove
- && (curwin->w_cursor.col != 0
- || curwin->w_cursor.coladd > 0
- )
- && (restart_edit == NUL
- || (gchar_cursor() == NUL
- && !VIsual_active
- ))
+ && (curwin->w_cursor.col != 0 || curwin->w_cursor.coladd > 0)
+ && (restart_edit == NUL || (gchar_cursor() == NUL && !VIsual_active))
&& !revins_on) {
if (curwin->w_cursor.coladd > 0 || get_ve_flags() == VE_ALL) {
oneleft();
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index f871b6a884..c9b62db31c 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -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)) {
// Shift-Mouse click searches for the next occurrence of the word under
// the mouse pointer
- if (State & MODE_INSERT
- || (VIsual_active && VIsual_select)) {
+ if (State & MODE_INSERT || (VIsual_active && VIsual_select)) {
stuffcharReadbuff(Ctrl_O);
}
if (which_button == MOUSE_LEFT) {
@@ -2546,8 +2545,7 @@ static bool checkclearop(oparg_T *oap)
/// @return true if operator or Visual was active.
static bool checkclearopq(oparg_T *oap)
{
- if (oap->op_type == OP_NOP
- && !VIsual_active) {
+ if (oap->op_type == OP_NOP && !VIsual_active) {
return false;
}
clearopbeep(oap);
@@ -4472,7 +4470,6 @@ static void nv_scroll(cmdarg_T *cap)
static void nv_right(cmdarg_T *cap)
{
long n;
- int PAST_LINE;
if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) {
// <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->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
- // (theoretically) infinitely long.
+ // In virtual edit mode, there's no such thing as "past_line", as lines
+ // are (theoretically) infinitely long.
if (virtual_active()) {
- PAST_LINE = 0;
+ past_line = false;
}
for (n = cap->count1; n > 0; n--) {
- if ((!PAST_LINE && oneright() == false)
- || (PAST_LINE
- && *get_cursor_pos_ptr() == NUL)) {
+ if ((!past_line && oneright() == false)
+ || (past_line && *get_cursor_pos_ptr() == NUL)) {
// <Space> wraps to next line if 'whichwrap' has 's'.
// 'l' wraps to next line if 'whichwrap' has 'l'.
// CURS_RIGHT wraps to next line if 'whichwrap' has '>'.
@@ -4531,7 +4527,7 @@ static void nv_right(cmdarg_T *cap)
}
}
break;
- } else if (PAST_LINE) {
+ } else if (past_line) {
curwin->w_set_curswant = true;
if (virtual_active()) {
oneright();
@@ -6472,8 +6468,7 @@ static void nv_redo_or_register(cmdarg_T *cap)
static void nv_Undo(cmdarg_T *cap)
{
// In Visual mode and typing "gUU" triggers an operator
- if (cap->oap->op_type == OP_UPPER
- || VIsual_active) {
+ if (cap->oap->op_type == OP_UPPER || VIsual_active) {
// translate "gUU" to "gUgU"
cap->cmdchar = 'g';
cap->nchar = 'U';
@@ -6488,9 +6483,7 @@ static void nv_Undo(cmdarg_T *cap)
/// single character.
static void nv_tilde(cmdarg_T *cap)
{
- if (!p_to
- && !VIsual_active
- && cap->oap->op_type != OP_TILDE) {
+ if (!p_to && !VIsual_active && cap->oap->op_type != OP_TILDE) {
if (bt_prompt(curbuf) && !prompt_curpos_editable()) {
clearopbeep(cap->oap);
return;
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 2f29e94ff1..21ab26898e 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -6627,9 +6627,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
switch (oap->op_type) {
case OP_LSHIFT:
case OP_RSHIFT:
- op_shift(oap, true,
- oap->is_VIsual ? (int)cap->count1 :
- 1);
+ op_shift(oap, true, oap->is_VIsual ? (int)cap->count1 : 1);
auto_format(false, true);
break;
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 15e8bd9e13..a915594e26 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -514,7 +514,7 @@ void last_pat_prog(regmmatch_T *regmatch)
--emsg_off;
}
-/// lowest level search function.
+/// Lowest level search function.
/// Search for 'count'th occurrence of pattern "pat" in direction "dir".
/// 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) {
col_start -= n; // uneven number of escape chars, skip it
- } else if (line[col_start] ==
- quotechar) {
+ } else if (line[col_start] == quotechar) {
break;
}
}
@@ -4115,8 +4114,7 @@ bool current_quote(oparg_T *oap, long count, bool include, int quotechar)
col_end = curwin->w_cursor.col;
}
}
- } else if (line[col_start] == quotechar
- || !vis_empty) {
+ } else if (line[col_start] == quotechar || !vis_empty) {
int first_col = col_start;
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 ".
// For v2i" include the quotes.
- if (!include && count < 2
- && (vis_empty || !inside_quotes)) {
- ++col_start;
+ if (!include && count < 2 && (vis_empty || !inside_quotes)) {
+ col_start++;
}
curwin->w_cursor.col = col_start;
if (VIsual_active) {