From fe074611cd5b3319a3f639f68289df6a718e64eb Mon Sep 17 00:00:00 2001 From: Jurica Bradarić Date: Sun, 6 Oct 2019 05:35:48 +0200 Subject: vim-patch:8.1.1371: cannot recover from a swap file #11081 Problem: Cannot recover from a swap file. Solution: Do not expand environment variables in the swap file name. Do not check the extension when we already know a file is a swap file. (Ken Takata, closes 4415, closes vim/vim#4369) https://github.com/vim/vim/commit/99499b1c05f85f83876b828eea3f6e14f0f407b4 --- src/nvim/ex_cmds2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 813d1a9b0b..87eae2dd4f 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1743,7 +1743,7 @@ static bool editing_arg_idx(win_T *win) && (win->w_buffer->b_ffname == NULL || !(path_full_compare( alist_name(&WARGLIST(win)[win->w_arg_idx]), - win->w_buffer->b_ffname, true) & kEqualFiles)))); + win->w_buffer->b_ffname, true, true) & kEqualFiles)))); } /// Check if window "win" is editing the w_arg_idx file in its argument list. @@ -1761,7 +1761,7 @@ void check_arg_idx(win_T *win) && (win->w_buffer->b_fnum == GARGLIST[GARGCOUNT - 1].ae_fnum || (win->w_buffer->b_ffname != NULL && (path_full_compare(alist_name(&GARGLIST[GARGCOUNT - 1]), - win->w_buffer->b_ffname, true) + win->w_buffer->b_ffname, true, true) & kEqualFiles)))) { arg_had_last = true; } -- cgit From 0586a4b512b2495d32f20c46946d35a0d403bd52 Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Mon, 23 Sep 2019 21:19:26 +0200 Subject: vim-patch:8.1.1588: in :let-heredoc line continuation is recognized Problem: In :let-heredoc line continuation is recognized. Solution: Do not consume line continuation. (Ozaki Kiichi, closes vim/vim#4580) https://github.com/vim/vim/commit/e96a2498f9a2d3e93ac07431f6d4afd77f30afdf --- src/nvim/ex_cmds2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 87eae2dd4f..272c81e29b 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3218,7 +3218,7 @@ int do_source(char_u *fname, int check_other, int is_vimrc) cookie.conv.vc_type = CONV_NONE; // no conversion // Read the first line so we can check for a UTF-8 BOM. - firstline = getsourceline(0, (void *)&cookie, 0); + firstline = getsourceline(0, (void *)&cookie, 0, true); if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef && firstline[1] == 0xbb && firstline[2] == 0xbf) { // Found BOM; setup conversion, skip over BOM and recode the line. @@ -3381,7 +3381,7 @@ void free_scriptnames(void) /// /// @return pointer to the line in allocated memory, or NULL for end-of-file or /// some error. -char_u *getsourceline(int c, void *cookie, int indent) +char_u *getsourceline(int c, void *cookie, int indent, bool do_concat) { struct source_cookie *sp = (struct source_cookie *)cookie; char_u *line; @@ -3412,7 +3412,7 @@ char_u *getsourceline(int c, void *cookie, int indent) // Only concatenate lines starting with a \ when 'cpoptions' doesn't // contain the 'C' flag. - if (line != NULL && (vim_strchr(p_cpo, CPO_CONCAT) == NULL)) { + if (line != NULL && do_concat && (vim_strchr(p_cpo, CPO_CONCAT) == NULL)) { // compensate for the one line read-ahead sourcing_lnum--; -- cgit From fcc24d0df3b1a6bde82c0e5b90f1392639f3fa5b Mon Sep 17 00:00:00 2001 From: Jurica Bradaric Date: Sat, 12 Oct 2019 22:49:21 +0200 Subject: vim-patch:8.1.1625: script line numbers are not exactly right Problem: Script line numbers are not exactly right. Solution: Handle heredoc and continuation lines better. (Ozaki Kiichi, closes vim/vim#4611, closes vim/vim#4511) https://github.com/vim/vim/commit/bc2cfe4672d370330b8698d4d025697a9a6ec569 --- src/nvim/ex_cmds2.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 272c81e29b..84291b3637 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -97,10 +97,11 @@ typedef struct sn_prl_S { struct source_cookie { FILE *fp; ///< opened file for sourcing char_u *nextline; ///< if not NULL: line that was read ahead + linenr_T sourcing_lnum; ///< line number of the source file int finished; ///< ":finish" used #if defined(USE_CRNL) int fileformat; ///< EOL_UNKNOWN, EOL_UNIX or EOL_DOS - bool error; ///< true if LF found after CR-LF + bool error; ///< true if LF found after CR-LF #endif linenr_T breakpoint; ///< next line with breakpoint or zero char_u *fname; ///< name of sourced file @@ -3124,6 +3125,7 @@ int do_source(char_u *fname, int check_other, int is_vimrc) #endif cookie.nextline = NULL; + cookie.sourcing_lnum = 0; cookie.finished = false; // Check if this script has a breakpoint. @@ -3375,6 +3377,13 @@ void free_scriptnames(void) } # endif +linenr_T get_sourced_lnum(LineGetter fgetline, void *cookie) +{ + return fgetline == getsourceline + ? ((struct source_cookie *)cookie)->sourcing_lnum + : sourcing_lnum; +} + /// Get one full line from a sourced file. /// Called by do_cmdline() when it's called from do_source(). @@ -3395,6 +3404,8 @@ char_u *getsourceline(int c, void *cookie, int indent, bool do_concat) if (do_profiling == PROF_YES) { script_line_end(); } + // Set the current sourcing line number. + sourcing_lnum = sp->sourcing_lnum + 1; // Get current line. If there is a read-ahead line, use it, otherwise get // one now. if (sp->finished) { @@ -3404,7 +3415,7 @@ char_u *getsourceline(int c, void *cookie, int indent, bool do_concat) } else { line = sp->nextline; sp->nextline = NULL; - sourcing_lnum++; + sp->sourcing_lnum++; } if (line != NULL && do_profiling == PROF_YES) { script_line_start(); @@ -3414,7 +3425,7 @@ char_u *getsourceline(int c, void *cookie, int indent, bool do_concat) // contain the 'C' flag. if (line != NULL && do_concat && (vim_strchr(p_cpo, CPO_CONCAT) == NULL)) { // compensate for the one line read-ahead - sourcing_lnum--; + sp->sourcing_lnum--; // Get the next line and concatenate it when it starts with a // backslash. We always need to read the next line, keep it in @@ -3492,7 +3503,7 @@ static char_u *get_one_sourceline(struct source_cookie *sp) ga_init(&ga, 1, 250); // Loop until there is a finished line (or end-of-file). - sourcing_lnum++; + sp->sourcing_lnum++; for (;; ) { // make room to read at least 120 (more) characters ga_grow(&ga, 120); @@ -3559,7 +3570,7 @@ retry: // len&c parities (is faster than ((len-c)%2 == 0)) -- Acevedo for (c = len - 2; c >= 0 && buf[c] == Ctrl_V; c--) {} if ((len & 1) != (c & 1)) { // escaped NL, read more - sourcing_lnum++; + sp->sourcing_lnum++; continue; } -- cgit From 6aa03e86da041284b5f27a59f73cef0991fc577e Mon Sep 17 00:00:00 2001 From: Siddhant Gupta Date: Sun, 6 Oct 2019 13:37:54 -0700 Subject: API: nvim_source --- src/nvim/ex_cmds2.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 84291b3637..904a3d10e5 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1193,7 +1193,7 @@ static void script_dump_profile(FILE *fd) /// profiled. bool prof_def_func(void) { - if (current_sctx.sc_sid > 0) { + if (current_sctx.sc_sid > 0 && current_SID < 999999) { return SCRIPT_ITEM(current_sctx.sc_sid).sn_pr_force; } return false; @@ -3015,6 +3015,44 @@ static FILE *fopen_noinh_readbin(char *filename) return fdopen(fd_tmp, READBIN); } +typedef struct { + char_u *buf; + size_t offset; +} GetStrLineCookie; + +static char_u *get_str_line(int c, void *cookie, int ident) +{ + GetStrLineCookie *p = cookie; + size_t i = p->offset; + if (strlen((char *)p->buf) <= p->offset) { + return NULL; + } + while (!(p->buf[i] == '\n' || p->buf[i] == '\0')) { + i++; + } + char buf[2046]; + char *dst; + dst = xstpncpy(buf, (char *)p->buf+p->offset, i - p->offset); + if ((uint32_t)(dst - buf) != i - p->offset) { + smsg(_("nvim_source error parsing command %s"), p->buf); + } + buf[i-p->offset]='\0'; + p->offset = i + 1; + return (char_u *)xstrdup(buf); +} + +int do_source_str(char_u *cmd) +{ + int retval; + GetStrLineCookie cookie = { + .buf = cmd, + .offset = 0, + }; + current_SID = 999999; + retval = do_cmdline(NULL, get_str_line, (void *)&cookie, + DOCMD_NOWAIT); + return retval; +} /// Read the file "fname" and execute its lines as EX commands. /// -- cgit From 0a8d145075d3ce5fffe2df190992f624ae931809 Mon Sep 17 00:00:00 2001 From: Vikram Pal Date: Sat, 5 Oct 2019 20:07:27 +0530 Subject: API: nvim_source: save/restore script context #11159 Use a constant for the script id. --- src/nvim/ex_cmds2.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 904a3d10e5..edfa3fea9a 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1193,7 +1193,7 @@ static void script_dump_profile(FILE *fd) /// profiled. bool prof_def_func(void) { - if (current_sctx.sc_sid > 0 && current_SID < 999999) { + if (current_sctx.sc_sid > 0) { return SCRIPT_ITEM(current_sctx.sc_sid).sn_pr_force; } return false; @@ -3048,9 +3048,13 @@ int do_source_str(char_u *cmd) .buf = cmd, .offset = 0, }; - current_SID = 999999; + const sctx_T save_current_sctx = current_sctx; + current_sctx.sc_sid = SID_STR; + current_sctx.sc_seq = 0; + current_sctx.sc_lnum = 0; retval = do_cmdline(NULL, get_str_line, (void *)&cookie, DOCMD_NOWAIT); + current_sctx = save_current_sctx; return retval; } -- cgit From 276c2da28616d7a4f504c328dbb8857d38ab7a4a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 6 Oct 2019 19:40:36 -0700 Subject: API: nvim_source: fix multiline input - DOCMD_REPEAT is needed to source all lines of input. - Fix ":verbose set {option}?" by handling SID_STR in get_scriptname(). closes #8722 --- src/nvim/ex_cmds2.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index edfa3fea9a..eec689a28d 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3020,6 +3020,11 @@ typedef struct { size_t offset; } GetStrLineCookie; +/// Get one full line from a sourced string (in-memory, no file). +/// Called by do_cmdline() when it's called from do_source_str(). +/// +/// @return pointer to allocated line, or NULL for end-of-file or +/// some error. static char_u *get_str_line(int c, void *cookie, int ident) { GetStrLineCookie *p = cookie; @@ -3034,18 +3039,19 @@ static char_u *get_str_line(int c, void *cookie, int ident) char *dst; dst = xstpncpy(buf, (char *)p->buf+p->offset, i - p->offset); if ((uint32_t)(dst - buf) != i - p->offset) { - smsg(_("nvim_source error parsing command %s"), p->buf); + smsg(_(":source error parsing command %s"), p->buf); + return NULL; } buf[i-p->offset]='\0'; p->offset = i + 1; return (char_u *)xstrdup(buf); } -int do_source_str(char_u *cmd) +int do_source_str(const char *cmd) { int retval; GetStrLineCookie cookie = { - .buf = cmd, + .buf = (char_u *)cmd, .offset = 0, }; const sctx_T save_current_sctx = current_sctx; @@ -3053,7 +3059,7 @@ int do_source_str(char_u *cmd) current_sctx.sc_seq = 0; current_sctx.sc_lnum = 0; retval = do_cmdline(NULL, get_str_line, (void *)&cookie, - DOCMD_NOWAIT); + DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT); current_sctx = save_current_sctx; return retval; } @@ -3402,6 +3408,8 @@ char_u *get_scriptname(LastSet last_set, bool *should_free) _("API client (channel id %" PRIu64 ")"), last_set.channel_id); return IObuff; + case SID_STR: + return (char_u *)_(":source (no file)"); default: *should_free = true; return home_replace_save(NULL, -- cgit From bd43e011b5b0feba644ec5feae6c174def31a9e4 Mon Sep 17 00:00:00 2001 From: Vikram Pal Date: Wed, 9 Oct 2019 18:34:37 +0530 Subject: API: nvim_source_output - Similar to nvim_source but will capture the output - Add meaningful VimL tracebacks for nvim_source - Handle got_int - Add error reporting --- src/nvim/ex_cmds2.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index eec689a28d..bda7b4e8b5 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3025,7 +3025,7 @@ typedef struct { /// /// @return pointer to allocated line, or NULL for end-of-file or /// some error. -static char_u *get_str_line(int c, void *cookie, int ident) +static char_u *get_str_line(int c, void *cookie, int indent, bool do_concat) { GetStrLineCookie *p = cookie; size_t i = p->offset; @@ -3037,19 +3037,31 @@ static char_u *get_str_line(int c, void *cookie, int ident) } char buf[2046]; char *dst; - dst = xstpncpy(buf, (char *)p->buf+p->offset, i - p->offset); + dst = xstpncpy(buf, (char *)p->buf + p->offset, i - p->offset); if ((uint32_t)(dst - buf) != i - p->offset) { smsg(_(":source error parsing command %s"), p->buf); return NULL; } - buf[i-p->offset]='\0'; + buf[i - p->offset] = '\0'; p->offset = i + 1; return (char_u *)xstrdup(buf); } -int do_source_str(const char *cmd) +int do_source_str(const char *cmd, const char *traceback_name) { - int retval; + char_u *save_sourcing_name = sourcing_name; + linenr_T save_sourcing_lnum = sourcing_lnum; + char_u sourcing_name_buf[256]; + if (save_sourcing_name == NULL) { + sourcing_name = (char_u *)traceback_name; + } else { + snprintf((char *)sourcing_name_buf, sizeof sourcing_name_buf, + "%s called at %s:%"PRIdLINENR, traceback_name, save_sourcing_name, + save_sourcing_lnum); + sourcing_name = sourcing_name_buf; + } + sourcing_lnum = 0; + GetStrLineCookie cookie = { .buf = (char_u *)cmd, .offset = 0, @@ -3057,10 +3069,18 @@ int do_source_str(const char *cmd) const sctx_T save_current_sctx = current_sctx; current_sctx.sc_sid = SID_STR; current_sctx.sc_seq = 0; - current_sctx.sc_lnum = 0; - retval = do_cmdline(NULL, get_str_line, (void *)&cookie, - DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT); + current_sctx.sc_lnum = save_sourcing_lnum; + int retval = FAIL; + do_cmdline(NULL, get_str_line, (void *)&cookie, + DOCMD_VERBOSE | DOCMD_NOWAIT | DOCMD_REPEAT); + retval = OK; + if (got_int) { + EMSG(_(e_interr)); + } + current_sctx = save_current_sctx; + sourcing_lnum = save_sourcing_lnum; + sourcing_name = save_sourcing_name; return retval; } -- cgit From b1991f66d5845ccb72c73fdf39153a0e1fbb1124 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 1 Dec 2019 22:26:36 -0800 Subject: API: rename nvim_source => nvim_exec - Eliminate nvim_source_output(): add boolean `output` param to nvim_exec() instead. --- src/nvim/ex_cmds2.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index bda7b4e8b5..8479c15b40 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3047,6 +3047,9 @@ static char_u *get_str_line(int c, void *cookie, int indent, bool do_concat) return (char_u *)xstrdup(buf); } +/// Executes lines in `src` as Ex commands. +/// +/// @see do_source() int do_source_str(const char *cmd, const char *traceback_name) { char_u *save_sourcing_name = sourcing_name; @@ -3055,7 +3058,7 @@ int do_source_str(const char *cmd, const char *traceback_name) if (save_sourcing_name == NULL) { sourcing_name = (char_u *)traceback_name; } else { - snprintf((char *)sourcing_name_buf, sizeof sourcing_name_buf, + snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf), "%s called at %s:%"PRIdLINENR, traceback_name, save_sourcing_name, save_sourcing_lnum); sourcing_name = sourcing_name_buf; @@ -3070,24 +3073,20 @@ int do_source_str(const char *cmd, const char *traceback_name) current_sctx.sc_sid = SID_STR; current_sctx.sc_seq = 0; current_sctx.sc_lnum = save_sourcing_lnum; - int retval = FAIL; - do_cmdline(NULL, get_str_line, (void *)&cookie, - DOCMD_VERBOSE | DOCMD_NOWAIT | DOCMD_REPEAT); - retval = OK; - if (got_int) { - EMSG(_(e_interr)); - } - + int retval = do_cmdline(NULL, get_str_line, (void *)&cookie, + DOCMD_VERBOSE | DOCMD_NOWAIT | DOCMD_REPEAT); current_sctx = save_current_sctx; sourcing_lnum = save_sourcing_lnum; sourcing_name = save_sourcing_name; return retval; } -/// Read the file "fname" and execute its lines as EX commands. +/// Reads the file `fname` and executes its lines as Ex commands. /// /// This function may be called recursively! /// +/// @see do_source_str +/// /// @param fname /// @param check_other check for .vimrc and _vimrc /// @param is_vimrc DOSO_ value -- cgit From c34130d13a842ae0c0c1724d05800a954547d327 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 1 Dec 2019 22:43:16 -0800 Subject: API: deprecate nvim_command_output --- src/nvim/ex_cmds2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 8479c15b40..496aecfb27 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3428,7 +3428,7 @@ char_u *get_scriptname(LastSet last_set, bool *should_free) last_set.channel_id); return IObuff; case SID_STR: - return (char_u *)_(":source (no file)"); + return (char_u *)_("anonymous :source"); default: *should_free = true; return home_replace_save(NULL, -- cgit From 1cbe8d6d78a6d9fcef36daab5231bb74e58f5c7f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 11 Jan 2020 19:31:05 -0500 Subject: vim-patch:8.0.1593: :qall never exits active :terminal #11704 Problem: :qall never exits with an active terminal window. Solution: Add a way to kill a job in a terminal window. https://github.com/vim/vim/commit/25cdd9c33b21ddbd31321c075873bb225450d2d2 --- src/nvim/ex_cmds2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 496aecfb27..a3d49c682e 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1414,6 +1414,7 @@ bool check_changed_any(bool hidden, bool unload) size_t bufcount = 0; int *bufnrs; + // Make a list of all buffers, with the most important ones first. FOR_ALL_BUFFERS(buf) { bufcount++; } @@ -1426,14 +1427,15 @@ bool check_changed_any(bool hidden, bool unload) // curbuf bufnrs[bufnum++] = curbuf->b_fnum; - // buf in curtab + + // buffers in current tab FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { if (wp->w_buffer != curbuf) { add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); } } - // buf in other tab + // buffers in other tabs FOR_ALL_TABS(tp) { if (tp != curtab) { FOR_ALL_WINDOWS_IN_TAB(wp, tp) { @@ -1442,7 +1444,7 @@ bool check_changed_any(bool hidden, bool unload) } } - // any other buf + // any other buffer FOR_ALL_BUFFERS(buf) { add_bufnum(bufnrs, &bufnum, buf->b_fnum); } @@ -1471,6 +1473,7 @@ bool check_changed_any(bool hidden, bool unload) goto theend; } + // Get here if "buf" cannot be abandoned. ret = true; exiting = false; // When ":confirm" used, don't give an error message. -- cgit From d50c1123d5616c9757bb5707416696cda1a43716 Mon Sep 17 00:00:00 2001 From: Jakub Łuczyński Date: Mon, 10 Feb 2020 18:34:18 +0100 Subject: fix: includes --- src/nvim/ex_cmds2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index a3d49c682e..9a21374d85 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -20,7 +20,7 @@ #include "nvim/buffer.h" #include "nvim/change.h" #include "nvim/charset.h" -#include "nvim/eval.h" +#include "nvim/eval/user_funcs.h" #include "nvim/ex_cmds.h" #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" -- cgit From 5e815edece308a91296720cd6cb8d988af6c90c8 Mon Sep 17 00:00:00 2001 From: Jakub Łuczyński Date: Tue, 11 Feb 2020 16:19:14 +0100 Subject: rename: user_funcs -> userfunc Lets stick with vim for now --- src/nvim/ex_cmds2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 9a21374d85..3694e909d2 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -20,7 +20,7 @@ #include "nvim/buffer.h" #include "nvim/change.h" #include "nvim/charset.h" -#include "nvim/eval/user_funcs.h" +#include "nvim/eval/userfunc.h" #include "nvim/ex_cmds.h" #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" -- cgit From 88f46501144801736c22db49eb96f88b98903028 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 3 May 2020 13:35:10 -0400 Subject: vim-patch:8.2.0688: output clobbered if setting 'verbose' to see shell commands Problem: Output clobbered if setting 'verbose' to see shell commands. Solution: Only output "Searching for" when 'verbose' is 11 or higher. https://github.com/vim/vim/commit/647a530b33d9d767f591159c24c62de48e57dad7 --- src/nvim/ex_cmds2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 3694e909d2..fbdd64e43e 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2394,7 +2394,7 @@ int do_in_path(char_u *path, char_u *name, int flags, char_u *rtp_copy = vim_strsave(path); char_u *buf = xmallocz(MAXPATHL); { - if (p_verbose > 1 && name != NULL) { + if (p_verbose > 10 && name != NULL) { verbose_enter(); smsg(_("Searching for \"%s\" in \"%s\""), (char *)name, (char *)path); @@ -2436,7 +2436,7 @@ int do_in_path(char_u *path, char_u *name, int flags, copy_option_part(&np, tail, (size_t)(MAXPATHL - (tail - buf)), "\t "); - if (p_verbose > 2) { + if (p_verbose > 10) { verbose_enter(); smsg(_("Searching for \"%s\""), buf); verbose_leave(); -- cgit From 17f067f4b4799dde06be78f9b7c9e7c7d60900a2 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sat, 31 Aug 2019 15:09:30 +0900 Subject: vim-patch:8.1.0475: memory not freed on exit when quit in autocmd Problem: Memory not freed on exit when quit in autocmd. Solution: Remember funccal stack when executing autocmd. https://github.com/vim/vim/commit/27e80c885bcb5c5cf6a6462d71d6c81b06ba2451 --- src/nvim/ex_cmds2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index fbdd64e43e..821227ec7a 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3106,7 +3106,6 @@ int do_source(char_u *fname, int check_other, int is_vimrc) int retval = FAIL; static scid_T last_current_SID = 0; static int last_current_SID_seq = 0; - void *save_funccalp; int save_debug_break_level = debug_break_level; scriptitem_T *si = NULL; proftime_T wait_start; @@ -3227,7 +3226,8 @@ int do_source(char_u *fname, int check_other, int is_vimrc) // Don't use local function variables, if called from a function. // Also starts profiling timer for nested script. - save_funccalp = save_funccal(); + funccal_entry_T funccalp_entry; + save_funccal(&funccalp_entry); // Check if this script was sourced before to finds its SID. // If it's new, generate a new SID. @@ -3352,7 +3352,7 @@ int do_source(char_u *fname, int check_other, int is_vimrc) } current_sctx = save_current_sctx; - restore_funccal(save_funccalp); + restore_funccal(); if (l_do_profiling == PROF_YES) { prof_child_exit(&wait_start); // leaving a child now } -- cgit From 861aade680925a240e6f5ae2ba29513abc1eb8f6 Mon Sep 17 00:00:00 2001 From: erw7 Date: Fri, 8 May 2020 12:05:34 +0900 Subject: viml/profile: fix use after free fixes #12255. --- src/nvim/ex_cmds2.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index fbdd64e43e..a6bc32581f 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1045,9 +1045,10 @@ static void profile_reset(void) uf->uf_tm_self = profile_zero(); uf->uf_tm_children = profile_zero(); - XFREE_CLEAR(uf->uf_tml_count); - XFREE_CLEAR(uf->uf_tml_total); - XFREE_CLEAR(uf->uf_tml_self); + for (int i = 0; i < uf->uf_lines.ga_len; i++) { + uf->uf_tml_count[i] = 0; + uf->uf_tml_total[i] = uf->uf_tml_self[i] = 0; + } uf->uf_tml_start = profile_zero(); uf->uf_tml_children = profile_zero(); -- cgit From 949783fdfaf937d8ac4a88c82e432c5613ae2634 Mon Sep 17 00:00:00 2001 From: erw7 Date: Sat, 9 May 2020 11:17:59 +0900 Subject: viml/profile: fix issue where profile is not reset on stop --- src/nvim/ex_cmds2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/ex_cmds2.c') diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index a6bc32581f..9f4055af8d 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -1038,7 +1038,7 @@ static void profile_reset(void) if (!HASHITEM_EMPTY(hi)) { n--; ufunc_T *uf = HI2UF(hi); - if (uf->uf_profiling) { + if (uf->uf_prof_initialized) { uf->uf_profiling = 0; uf->uf_tm_count = 0; uf->uf_tm_total = profile_zero(); -- cgit