aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2021-11-01 11:27:42 -0400
committerGitHub <noreply@github.com>2021-11-01 11:27:42 -0400
commitb8eabb37b1d4e267a4db7e639e8cbdec2ed64b8e (patch)
treed8fc27ffbbb9ece2b15008b09d4b4a6b89d0d20b /src
parent961cd83b3b39855b232841f37ded856c8621bd90 (diff)
parent9e479ea05e00e63ccc985fc8ce4912c709f30111 (diff)
downloadrneovim-b8eabb37b1d4e267a4db7e639e8cbdec2ed64b8e.tar.gz
rneovim-b8eabb37b1d4e267a4db7e639e8cbdec2ed64b8e.tar.bz2
rneovim-b8eabb37b1d4e267a4db7e639e8cbdec2ed64b8e.zip
Merge pull request #16131 from jamessan/vim-8.1.0306
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/vim.c2
-rw-r--r--src/nvim/autocmd.c30
-rw-r--r--src/nvim/buffer.c118
-rw-r--r--src/nvim/change.c4
-rw-r--r--src/nvim/channel.c6
-rw-r--r--src/nvim/context.c2
-rw-r--r--src/nvim/cursor_shape.c12
-rw-r--r--src/nvim/debugger.c16
-rw-r--r--src/nvim/diff.c28
-rw-r--r--src/nvim/digraph.c14
-rw-r--r--src/nvim/edit.c28
-rw-r--r--src/nvim/eval.c296
-rw-r--r--src/nvim/eval/decode.c82
-rw-r--r--src/nvim/eval/encode.c18
-rw-r--r--src/nvim/eval/executor.c2
-rw-r--r--src/nvim/eval/funcs.c422
-rw-r--r--src/nvim/eval/typval.c66
-rw-r--r--src/nvim/eval/typval.h4
-rw-r--r--src/nvim/eval/userfunc.c74
-rw-r--r--src/nvim/ex_cmds.c166
-rw-r--r--src/nvim/ex_cmds2.c44
-rw-r--r--src/nvim/ex_cmds_defs.h2
-rw-r--r--src/nvim/ex_docmd.c569
-rw-r--r--src/nvim/ex_eval.c68
-rw-r--r--src/nvim/ex_eval.h6
-rw-r--r--src/nvim/ex_getln.c36
-rw-r--r--src/nvim/ex_session.c10
-rw-r--r--src/nvim/file_search.c14
-rw-r--r--src/nvim/fileio.c94
-rw-r--r--src/nvim/fold.c14
-rw-r--r--src/nvim/getchar.c34
-rw-r--r--src/nvim/gettext.h2
-rw-r--r--src/nvim/globals.h284
-rw-r--r--src/nvim/hardcopy.c64
-rw-r--r--src/nvim/hashtab.c4
-rw-r--r--src/nvim/highlight.c2
-rw-r--r--src/nvim/if_cscope.c91
-rw-r--r--src/nvim/keymap.c6
-rw-r--r--src/nvim/lua/converter.c16
-rw-r--r--src/nvim/lua/executor.c12
-rw-r--r--src/nvim/main.c8
-rw-r--r--src/nvim/mark.c26
-rw-r--r--src/nvim/mbyte.c4
-rw-r--r--src/nvim/memfile.c10
-rw-r--r--src/nvim/memline.c186
-rw-r--r--src/nvim/memory.c2
-rw-r--r--src/nvim/menu.c50
-rw-r--r--src/nvim/message.c130
-rw-r--r--src/nvim/message.h47
-rw-r--r--src/nvim/misc1.c36
-rw-r--r--src/nvim/normal.c28
-rw-r--r--src/nvim/ops.c108
-rw-r--r--src/nvim/option.c146
-rw-r--r--src/nvim/os/dl.c4
-rw-r--r--src/nvim/os/env.c12
-rw-r--r--src/nvim/os/fileio.c2
-rw-r--r--src/nvim/os/fs.c6
-rw-r--r--src/nvim/os/shell.c16
-rw-r--r--src/nvim/os/users.c2
-rw-r--r--src/nvim/path.c6
-rw-r--r--src/nvim/quickfix.c139
-rw-r--r--src/nvim/regexp.c50
-rw-r--r--src/nvim/regexp_nfa.c40
-rw-r--r--src/nvim/runtime.c4
-rw-r--r--src/nvim/screen.c40
-rw-r--r--src/nvim/search.c56
-rw-r--r--src/nvim/shada.c134
-rw-r--r--src/nvim/sign.c56
-rw-r--r--src/nvim/spell.c21
-rw-r--r--src/nvim/spellfile.c84
-rw-r--r--src/nvim/strings.c14
-rw-r--r--src/nvim/syntax.c210
-rw-r--r--src/nvim/tag.c54
-rw-r--r--src/nvim/tui/input.c2
-rw-r--r--src/nvim/undo.c68
-rw-r--r--src/nvim/version.c18
-rw-r--r--src/nvim/vim.h4
-rw-r--r--src/nvim/viml/parser/expressions.h2
-rw-r--r--src/nvim/window.c68
79 files changed, 2260 insertions, 2395 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 5e57c5c516..2fbafb9889 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1724,7 +1724,7 @@ static void write_msg(String message, bool to_err)
#define PUSH_CHAR(i, pos, line_buf, msg) \
if (message.data[i] == NL || pos == LINE_BUFFER_SIZE - 1) { \
line_buf[pos] = NUL; \
- msg((char_u *)line_buf); \
+ msg(line_buf); \
pos = 0; \
continue; \
} \
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index d991b88131..2d0c0f3fd5 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -313,9 +313,9 @@ static void au_del_group(char_u *name)
{
int i = au_find_group(name);
if (i == AUGROUP_ERROR) { // the group doesn't exist
- EMSG2(_("E367: No such group: \"%s\""), name);
+ semsg(_("E367: No such group: \"%s\""), name);
} else if (i == current_augroup) {
- EMSG(_("E936: Cannot delete the current group"));
+ emsg(_("E936: Cannot delete the current group"));
} else {
event_T event;
AutoPat *ap;
@@ -372,7 +372,7 @@ void do_augroup(char_u *arg, int del_group)
{
if (del_group) {
if (*arg == NUL) {
- EMSG(_(e_argreq));
+ emsg(_(e_argreq));
} else {
au_del_group(arg);
}
@@ -469,7 +469,7 @@ static char_u *find_end_event(char_u *arg, int have_group)
if (*arg == '*') {
if (arg[1] && !ascii_iswhite(arg[1])) {
- EMSG2(_("E215: Illegal character after *: %s"), arg);
+ semsg(_("E215: Illegal character after *: %s"), arg);
return NULL;
}
pat = arg + 1;
@@ -477,9 +477,9 @@ static char_u *find_end_event(char_u *arg, int have_group)
for (pat = arg; *pat && *pat != '|' && !ascii_iswhite(*pat); pat = p) {
if ((int)event_name2nr(pat, &p) >= NUM_EVENTS) {
if (have_group) {
- EMSG2(_("E216: No such event: %s"), pat);
+ semsg(_("E216: No such event: %s"), pat);
} else {
- EMSG2(_("E216: No such group or event: %s"), pat);
+ semsg(_("E216: No such group or event: %s"), pat);
}
return NULL;
}
@@ -651,7 +651,7 @@ void do_autocmd(char_u *arg_in, int forceit)
// Check for "++once" flag.
if (STRNCMP(cmd, "++once", 6) == 0 && ascii_iswhite(cmd[6])) {
if (once) {
- EMSG2(_(e_duparg2), "++once");
+ semsg(_(e_duparg2), "++once");
}
once = true;
cmd = skipwhite(cmd + 6);
@@ -660,7 +660,7 @@ void do_autocmd(char_u *arg_in, int forceit)
// Check for "++nested" flag.
if ((STRNCMP(cmd, "++nested", 8) == 0 && ascii_iswhite(cmd[8]))) {
if (nested) {
- EMSG2(_(e_duparg2), "++nested");
+ semsg(_(e_duparg2), "++nested");
}
nested = true;
cmd = skipwhite(cmd + 8);
@@ -669,7 +669,7 @@ void do_autocmd(char_u *arg_in, int forceit)
// Check for the old (deprecated) "nested" flag.
if (STRNCMP(cmd, "nested", 6) == 0 && ascii_iswhite(cmd[6])) {
if (nested) {
- EMSG2(_(e_duparg2), "nested");
+ semsg(_(e_duparg2), "nested");
}
nested = true;
cmd = skipwhite(cmd + 6);
@@ -691,7 +691,7 @@ void do_autocmd(char_u *arg_in, int forceit)
// Print header when showing autocommands.
if (!forceit && *cmd == NUL) {
// Highlight title
- MSG_PUTS_TITLE(_("\n--- Autocommands ---"));
+ msg_puts_title(_("\n--- Autocommands ---"));
}
// Loop over the events.
@@ -699,7 +699,7 @@ void do_autocmd(char_u *arg_in, int forceit)
last_group = AUGROUP_ERROR; // for listing the group name
if (*arg == '*' || *arg == NUL || *arg == '|') {
if (!forceit && *cmd != NUL) {
- EMSG(_(e_cannot_define_autocommands_for_all_events));
+ emsg(_(e_cannot_define_autocommands_for_all_events));
} else {
for (event_T event = (event_T)0; event < NUM_EVENTS;
event = (event_T)(event + 1)) {
@@ -899,7 +899,7 @@ static int do_autocmd_event(event_T event, char_u *pat, bool once, int nested, c
// refuse to add buffer-local ap if buffer number is invalid
if (is_buflocal
&& (buflocal_nr == 0 || buflist_findnr(buflocal_nr) == NULL)) {
- emsgf(_("E680: <buffer=%d>: invalid buffer number "), buflocal_nr);
+ semsg(_("E680: <buffer=%d>: invalid buffer number "), buflocal_nr);
return FAIL;
}
@@ -974,7 +974,7 @@ int do_doautocmd(char_u *arg, bool do_msg, bool *did_something)
group = au_get_grouparg(&arg);
if (*arg == '*') {
- EMSG(_("E217: Can't execute autocommands for ALL events"));
+ emsg(_("E217: Can't execute autocommands for ALL events"));
return FAIL;
}
@@ -996,7 +996,7 @@ int do_doautocmd(char_u *arg, bool do_msg, bool *did_something)
}
if (nothing_done && do_msg) {
- MSG(_("No matching autocommands"));
+ msg(_("No matching autocommands"));
}
if (did_something != NULL) {
*did_something = !nothing_done;
@@ -1414,7 +1414,7 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
// Allow nesting of autocommands, but restrict the depth, because it's
// possible to create an endless loop.
if (nesting == 10) {
- EMSG(_("E218: autocommand nesting too deep"));
+ emsg(_("E218: autocommand nesting too deep"));
goto BYPASS_AU;
}
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index a4c7b1816c..4692f9e722 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -186,7 +186,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
// If there is no memfile at all, exit.
// This is OK, since there are no changes to lose.
if (curbuf == NULL) {
- EMSG(_("E82: Cannot allocate any buffer, exiting..."));
+ emsg(_("E82: Cannot allocate any buffer, exiting..."));
// Don't try to do any saving, with "curbuf" NULL almost nothing
// will work.
@@ -194,7 +194,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
getout(2);
}
- EMSG(_("E83: Cannot allocate buffer, using other one..."));
+ emsg(_("E83: Cannot allocate buffer, using other one..."));
enter_buffer(curbuf);
if (old_tw != curbuf->b_p_tw) {
check_colorcolumn(curwin);
@@ -439,7 +439,7 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
// Disallow deleting the buffer when it is locked (already being closed or
// halfway a command that relies on it). Unloading is allowed.
if (buf->b_locked > 0 && (del_buf || wipe_buf)) {
- EMSG(_("E937: Attempt to delete a buffer that is in use"));
+ emsg(_("E937: Attempt to delete a buffer that is in use"));
return false;
}
@@ -466,13 +466,13 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
if (apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname, false,
buf) && !bufref_valid(&bufref)) {
// Autocommands deleted the buffer.
- EMSG(_(e_auabort));
+ emsg(_(e_auabort));
return false;
}
buf->b_locked--;
if (abort_if_last && last_nonfloat(win)) {
// Autocommands made this the only window.
- EMSG(_(e_auabort));
+ emsg(_(e_auabort));
return false;
}
@@ -483,13 +483,13 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
if (apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname, false,
buf) && !bufref_valid(&bufref)) {
// Autocommands deleted the buffer.
- EMSG(_(e_auabort));
+ emsg(_(e_auabort));
return false;
}
buf->b_locked--;
if (abort_if_last && last_nonfloat(win)) {
// Autocommands made this the only window.
- EMSG(_(e_auabort));
+ emsg(_(e_auabort));
return false;
}
}
@@ -918,7 +918,7 @@ void handle_swap_exists(bufref_T *old_curbuf)
// User selected Recover at ATTENTION prompt.
msg_scroll = true;
ml_recover(false);
- MSG_PUTS("\n"); // don't overwrite the last message
+ msg_puts("\n"); // don't overwrite the last message
cmdline_row = msg_row;
do_modelines(0);
@@ -944,11 +944,11 @@ void handle_swap_exists(bufref_T *old_curbuf)
/// @param end_bnr buffer nr or last buffer nr in a range
///
/// @return error message or NULL
-char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit)
+char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit)
{
int do_current = 0; // delete current buffer?
int deleted = 0; // number of buffers deleted
- char_u *errormsg = NULL; // return value
+ char *errormsg = NULL; // return value
int bnr; // buffer number
char_u *p;
@@ -957,7 +957,7 @@ char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int e
} else {
if (addr_count == 2) {
if (*arg) { // both range and argument is not allowed
- return (char_u *)_(e_trailing);
+ return _(e_trailing);
}
bnr = start_bnr;
} else { // addr_count == 1
@@ -1013,26 +1013,17 @@ char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int e
} else {
STRCPY(IObuff, _("E517: No buffers were wiped out"));
}
- errormsg = IObuff;
+ errormsg = (char *)IObuff;
} else if (deleted >= p_report) {
if (command == DOBUF_UNLOAD) {
- if (deleted == 1) {
- MSG(_("1 buffer unloaded"));
- } else {
- smsg(_("%d buffers unloaded"), deleted);
- }
+ smsg(NGETTEXT("%d buffer unloaded", "%d buffers unloaded", (unsigned long)deleted),
+ deleted);
} else if (command == DOBUF_DEL) {
- if (deleted == 1) {
- MSG(_("1 buffer deleted"));
- } else {
- smsg(_("%d buffers deleted"), deleted);
- }
+ smsg(NGETTEXT("%d buffer deleted", "%d buffers deleted", (unsigned long)deleted),
+ deleted);
} else {
- if (deleted == 1) {
- MSG(_("1 buffer wiped out"));
- } else {
- smsg(_("%d buffers wiped out"), deleted);
- }
+ smsg(NGETTEXT("%d buffer wiped out", "%d buffers wiped out", (unsigned long)deleted),
+ deleted);
}
}
}
@@ -1052,7 +1043,7 @@ static int empty_curbuf(int close_others, int forceit, int action)
buf_T *buf = curbuf;
if (action == DOBUF_UNLOAD) {
- EMSG(_("E90: Cannot unload last buffer"));
+ emsg(_("E90: Cannot unload last buffer"));
return FAIL;
}
@@ -1125,7 +1116,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
} while (buf != curbuf && !bufIsChanged(buf));
}
if (!bufIsChanged(buf)) {
- EMSG(_("E84: No modified buffer found"));
+ emsg(_("E84: No modified buffer found"));
return FAIL;
}
} else if (start == DOBUF_FIRST && count) { // find specified buffer number
@@ -1158,7 +1149,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
}
if (bp == buf) {
// back where we started, didn't find anything.
- EMSG(_("E85: There is no listed buffer"));
+ emsg(_("E85: There is no listed buffer"));
return FAIL;
}
}
@@ -1168,12 +1159,12 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
if (start == DOBUF_FIRST) {
// don't warn when deleting
if (!unload) {
- EMSGN(_(e_nobufnr), count);
+ semsg(_(e_nobufnr), (int64_t)count);
}
} else if (dir == FORWARD) {
- EMSG(_("E87: Cannot go beyond last buffer"));
+ emsg(_("E87: Cannot go beyond last buffer"));
} else {
- EMSG(_("E88: Cannot go before first buffer"));
+ emsg(_("E88: Cannot go before first buffer"));
}
return FAIL;
}
@@ -1204,9 +1195,9 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
return FAIL;
}
} else {
- EMSGN(_("E89: No write since last change for buffer %" PRId64
+ semsg(_("E89: No write since last change for buffer %" PRId64
" (add ! to override)"),
- buf->b_fnum);
+ (int64_t)buf->b_fnum);
return FAIL;
}
}
@@ -1217,7 +1208,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
return FAIL;
}
} else {
- EMSG2(_("E89: %s will be killed (add ! to override)"),
+ semsg(_("E89: %s will be killed (add ! to override)"),
(char *)buf->b_fname);
return FAIL;
}
@@ -1606,9 +1597,9 @@ void no_write_message(void)
{
if (curbuf->terminal
&& channel_job_running((uint64_t)curbuf->b_p_channel)) {
- EMSG(_("E948: Job still running (add ! to end the job)"));
+ emsg(_("E948: Job still running (add ! to end the job)"));
} else {
- EMSG(_("E37: No write since last change (add ! to override)"));
+ emsg(_("E37: No write since last change (add ! to override)"));
}
}
@@ -1617,9 +1608,9 @@ void no_write_message_nobang(const buf_T *const buf)
{
if (buf->terminal
&& channel_job_running((uint64_t)buf->b_p_channel)) {
- EMSG(_("E948: Job still running"));
+ emsg(_("E948: Job still running"));
} else {
- EMSG(_("E37: No write since last change"));
+ emsg(_("E37: No write since last change"));
}
}
@@ -1802,7 +1793,7 @@ buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, int fl
buf->b_fnum = top_file_num++;
pmap_put(handle_T)(&buffer_handles, buf->b_fnum, buf);
if (top_file_num < 0) { // wrap around (may cause duplicates)
- EMSG(_("W14: Warning: List of file names overflow"));
+ emsg(_("W14: Warning: List of file names overflow"));
if (emsg_silent == 0) {
ui_flush();
os_delay(3001L, true); // make sure it is noticed
@@ -1971,9 +1962,9 @@ int buflist_getfile(int n, linenr_T lnum, int options, int forceit)
buf = buflist_findnr(n);
if (buf == NULL) {
if ((options & GETF_ALT) && n == 0) {
- EMSG(_(e_noalt));
+ emsg(_(e_noalt));
} else {
- EMSGN(_("E92: Buffer %" PRId64 " not found"), n);
+ semsg(_("E92: Buffer %" PRId64 " not found"), (int64_t)n);
}
return FAIL;
}
@@ -2233,9 +2224,9 @@ int buflist_findpat(const char_u *pattern, const char_u *pattern_end, bool unlis
}
if (match == -2) {
- EMSG2(_("E93: More than one match for %s"), pattern);
+ semsg(_("E93: More than one match for %s"), pattern);
} else if (match < 0) {
- EMSG2(_("E94: No matching buffer for %s"), pattern);
+ semsg(_("E94: No matching buffer for %s"), pattern);
}
return match;
}
@@ -2804,7 +2795,7 @@ int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, bool message)
if (obuf != NULL && obuf != buf) {
if (obuf->b_ml.ml_mfp != NULL) { // it's loaded, fail
if (message) {
- EMSG(_("E95: Buffer with this name already exists"));
+ emsg(_("E95: Buffer with this name already exists"));
}
xfree(ffname);
return FAIL;
@@ -2909,7 +2900,7 @@ char_u *getaltfname(bool errmsg)
if (buflist_name_nr(0, &fname, &dummy) == FAIL) {
if (errmsg) {
- EMSG(_(e_noalt));
+ emsg(_(e_noalt));
}
return NULL;
}
@@ -3048,14 +3039,14 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
{
char_u *name;
int n;
- char_u *p;
- char_u *buffer;
+ char *p;
+ char *buffer;
size_t len;
buffer = xmalloc(IOSIZE);
if (fullname > 1) { // 2 CTRL-G: include buffer number
- vim_snprintf((char *)buffer, IOSIZE, "buf %d: ", curbuf->b_fnum);
+ vim_snprintf(buffer, IOSIZE, "buf %d: ", curbuf->b_fnum);
p = buffer + STRLEN(buffer);
} else {
p = buffer;
@@ -3070,12 +3061,12 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
} else {
name = curbuf->b_ffname;
}
- home_replace(shorthelp ? curbuf : NULL, name, p,