aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-08-19 12:26:08 -0600
committerJosh Rahm <rahm@google.com>2022-08-19 13:06:41 -0600
commita7237662f96933efe29eed8212464571e3778cd0 (patch)
tree27930202726b4251437c8cfa53069f65b4db90dc /src/nvim/edit.c
parent02292344929069ea63c0bb872cc22d552d86b67f (diff)
parentb2f979b30beac67906b2dd717fcb6a34f46f5e54 (diff)
downloadrneovim-tmp.tar.gz
rneovim-tmp.tar.bz2
rneovim-tmp.zip
Merge branch 'master' of https://github.com/neovim/neovim into rahmtmp
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 969e0af9f5..3a47731715 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -16,6 +16,7 @@
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/digraph.h"
+#include "nvim/drawscreen.h"
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/event/loop.h"
@@ -25,6 +26,7 @@
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
+#include "nvim/grid.h"
#include "nvim/highlight_group.h"
#include "nvim/indent.h"
#include "nvim/indent_c.h"
@@ -46,9 +48,8 @@
#include "nvim/os/time.h"
#include "nvim/path.h"
#include "nvim/plines.h"
-#include "nvim/popupmnu.h"
+#include "nvim/popupmenu.h"
#include "nvim/quickfix.h"
-#include "nvim/screen.h"
#include "nvim/search.h"
#include "nvim/spell.h"
#include "nvim/state.h"
@@ -1747,7 +1748,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
replace_push(replaced);
replaced = NUL;
}
- ++start_col;
+ start_col++;
}
}
@@ -1913,7 +1914,7 @@ int get_literal(bool no_simplify)
cc = cc * 10 + nc - '0';
}
- ++i;
+ i++;
}
if (cc > 255
@@ -1948,7 +1949,7 @@ int get_literal(bool no_simplify)
cc = '\n';
}
- --no_mapping;
+ no_mapping--;
if (nc) {
vungetc(nc);
// A character typed with i_CTRL-V_digit cannot have modifiers.
@@ -2022,7 +2023,7 @@ static void insert_special(int c, int allow_modmask, int ctrlv)
/// @param second_indent indent for second line if >= 0
void insertchar(int c, int flags, int second_indent)
{
- char_u *p;
+ char *p;
int force_format = flags & INSCHAR_FORMAT;
const int textwidth = comp_textwidth(force_format);
@@ -2081,13 +2082,13 @@ void insertchar(int c, int flags, int second_indent)
// Need to remove existing (middle) comment leader and insert end
// comment leader. First, check what comment leader we can find.
char_u *line = get_cursor_line_ptr();
- int i = get_leader_len((char *)line, (char **)&p, false, true);
- if (i > 0 && vim_strchr((char *)p, COM_MIDDLE) != NULL) { // Just checking
+ int i = get_leader_len((char *)line, &p, false, true);
+ if (i > 0 && vim_strchr(p, COM_MIDDLE) != NULL) { // Just checking
// Skip middle-comment string
while (*p && p[-1] != ':') { // find end of middle flags
p++;
}
- int middle_len = (int)copy_option_part((char **)&p, (char *)lead_end, COM_MAX_LEN, ",");
+ int middle_len = (int)copy_option_part(&p, (char *)lead_end, COM_MAX_LEN, ",");
// Don't count trailing white space for middle_len
while (middle_len > 0 && ascii_iswhite(lead_end[middle_len - 1])) {
middle_len--;
@@ -2097,7 +2098,7 @@ void insertchar(int c, int flags, int second_indent)
while (*p && p[-1] != ':') { // find end of end flags
p++;
}
- int end_len = (int)copy_option_part((char **)&p, (char *)lead_end, COM_MAX_LEN, ",");
+ int end_len = (int)copy_option_part(&p, (char *)lead_end, COM_MAX_LEN, ",");
// Skip white space before the cursor
i = curwin->w_cursor.col;
@@ -3253,7 +3254,7 @@ int cursor_down(long n, int upd_topline)
if (hasFolding(lnum, NULL, &last)) {
lnum = last + 1;
} else {
- ++lnum;
+ lnum++;
}
if (lnum >= curbuf->b_ml.ml_line_count) {
break;
@@ -3433,7 +3434,7 @@ void replace_push(int c)
memmove(p + 1, p, (size_t)replace_offset);
}
*p = (char_u)c;
- ++replace_stack_nr;
+ replace_stack_nr++;
}
/*
@@ -3468,7 +3469,7 @@ static void replace_join(int off)
{
for (ssize_t i = replace_stack_nr; --i >= 0;) {
if (replace_stack[i] == NUL && off-- <= 0) {
- --replace_stack_nr;
+ replace_stack_nr--;
memmove(replace_stack + i, replace_stack + i + 1,
(size_t)(replace_stack_nr - i));
return;
@@ -3794,12 +3795,9 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
while (*look == '>') {
look++;
}
- }
- /*
- * Is it a word: "=word"?
- */
- else if (*look == '=' && look[1] != ',' && look[1] != NUL) {
- ++look;
+ // Is it a word: "=word"?
+ } else if (*look == '=' && look[1] != ',' && look[1] != NUL) {
+ look++;
if (*look == '~') {
icase = true;
look++;
@@ -4253,7 +4251,7 @@ static bool ins_esc(long *count, int cmdchar, bool nomove)
// Otherwise remove the mode message.
if (reg_recording != 0 || restart_edit != NUL) {
showmode();
- } else if (p_smd) {
+ } else if (p_smd && (got_int || !skip_showmode())) {
msg("");
}
// Exit Insert mode
@@ -5221,8 +5219,8 @@ static bool ins_tab(void)
// Find first white before the cursor
fpos = curwin->w_cursor;
while (fpos.col > 0 && ascii_iswhite(ptr[-1])) {
- --fpos.col;
- --ptr;
+ fpos.col--;
+ ptr--;
}
// In Replace mode, don't change characters before the insert point.
@@ -5254,8 +5252,8 @@ static bool ins_tab(void)
}
}
}
- ++fpos.col;
- ++ptr;
+ fpos.col++;
+ ptr++;
vcol += i;
}
@@ -5266,8 +5264,8 @@ static bool ins_tab(void)
// Skip over the spaces we need.
while (vcol < want_vcol && *ptr == ' ') {
vcol += lbr_chartabsize(line, ptr, vcol);
- ++ptr;
- ++repl_off;
+ ptr++;
+ repl_off++;
}
if (vcol > want_vcol) {
// Must have a char with 'showbreak' just before it.