diff src/vim9execute.c @ 23580:dc3b7a31c29f v8.2.2332

patch 8.2.2332: Vim9: missing :endif not reported when using :windo Commit: https://github.com/vim/vim/commit/9567efa1b4a41baca9b2266f5903d5dda7ad1e88 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 11 22:16:30 2021 +0100 patch 8.2.2332: Vim9: missing :endif not reported when using :windo Problem: Vim9: missing :endif not reported when using :windo. Solution: Pass a getline function to do_cmdline(). (closes https://github.com/vim/vim/issues/7650)
author Bram Moolenaar <Bram@vim.org>
date Mon, 11 Jan 2021 22:30:06 +0100
parents 754387a3aa35
children b875bbd517a6
line wrap: on
line diff
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1382,9 +1382,18 @@ call_def_function(
 	    // execute Ex command line
 	    case ISN_EXEC:
 		{
+		    source_cookie_T cookie;
+
 		    SOURCING_LNUM = iptr->isn_lnum;
-		    do_cmdline_cmd(iptr->isn_arg.string);
-		    if (did_emsg)
+		    // Pass getsourceline to get an error for a missing ":end"
+		    // command.
+		    CLEAR_FIELD(cookie);
+		    cookie.sourcing_lnum = iptr->isn_lnum - 1;
+		    if (do_cmdline(iptr->isn_arg.string,
+				getsourceline, &cookie,
+				   DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED)
+									== FAIL
+				|| did_emsg)
 			goto on_error;
 		}
 		break;