summaryrefslogtreecommitdiff
path: root/src/userfunc.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-01-26 16:50:05 +0100
committerBram Moolenaar <Bram@vim.org>2020-01-26 16:50:05 +0100
commit673660ab00d808d1e96e7181a60c5c8545c0ee75 (patch)
treef1640b455e435624fa045d972e7d27ee5b77dda1 /src/userfunc.c
parent8a7d6542b33e5d2b352262305c3bfdb2d14e1cf8 (diff)
downloadvim-git-673660ab00d808d1e96e7181a60c5c8545c0ee75.tar.gz
patch 8.2.0150: cannot define python function when using :executev8.2.0150
Problem: Cannot define python function when using :execute. (Yasuhiro Matsumoto) Solution: Do not recognize "def" inside "function.
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 808ed968a..ce776eeab 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2667,8 +2667,11 @@ ex_function(exarg_T *eap)
indent += 2;
// Check for defining a function inside this function.
+ // Only recognize "def" inside "def", not inside "function",
+ // For backwards compatibility, see Test_function_python().
c = *p;
- if (checkforcmd(&p, "function", 2) || checkforcmd(&p, "def", 3))
+ if (checkforcmd(&p, "function", 2)
+ || (eap->cmdidx == CMD_def && checkforcmd(&p, "def", 3)))
{
if (*p == '!')
p = skipwhite(p + 1);