diff src/userfunc.c @ 11543:57c452316da1 v8.0.0654

patch 8.0.0654: no warning for text after :endfunction commit https://github.com/vim/vim/commit/663bb2331626944cea156374858131fcd323b9e9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 22 19:12:10 2017 +0200 patch 8.0.0654: no warning for text after :endfunction Problem: Text found after :endfunction is silently ignored. Solution: Give a warning if 'verbose' is set. When | or \n are used, execute the text as a command.
author Christian Brabandt <cb@256bit.org>
date Thu, 22 Jun 2017 19:15:04 +0200
parents 77f3b7316d8b
children 1780e6fecb30
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2130,6 +2130,14 @@ ex_function(exarg_T *eap)
 	    /* Check for "endfunction". */
 	    if (checkforcmd(&p, "endfunction", 4) && nesting-- == 0)
 	    {
+		if (*p == '|')
+		    /* Another command follows. */
+		    eap->nextcmd = vim_strsave(p + 1);
+		else if (line_arg != NULL && *skipwhite(line_arg) != NUL)
+		    /* Another command follows. */
+		    eap->nextcmd = line_arg;
+		else if (*p != NUL && *p != '"' && p_verbose > 0)
+		    EMSG2((char_u *)_("E946: Text found after :endfunction: %s"), p);
 		if (line_arg == NULL)
 		    vim_free(theline);
 		break;