summaryrefslogtreecommitdiffstats
path: root/src/userfunc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/userfunc.c')
-rw-r--r--src/userfunc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/userfunc.c b/src/userfunc.c
index 864c816f24..6bfe534a9e 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2008,7 +2008,8 @@ ex_function(exarg_T *eap)
int todo;
hashitem_T *hi;
int do_concat = TRUE;
- int sourcing_lnum_off;
+ linenr_T sourcing_lnum_off;
+ linenr_T sourcing_lnum_top;
/*
* ":function" without argument: list functions.
@@ -2275,6 +2276,9 @@ ex_function(exarg_T *eap)
cmdline_row = msg_row;
}
+ // Save the starting line number.
+ sourcing_lnum_top = sourcing_lnum;
+
indent = 2;
nesting = 0;
for (;;)
@@ -2285,7 +2289,6 @@ ex_function(exarg_T *eap)
saved_wait_return = FALSE;
}
need_wait_return = FALSE;
- sourcing_lnum_off = sourcing_lnum;
if (line_arg != NULL)
{
@@ -2318,8 +2321,9 @@ ex_function(exarg_T *eap)
}
/* Detect line continuation: sourcing_lnum increased more than one. */
- if (sourcing_lnum > sourcing_lnum_off + 1)
- sourcing_lnum_off = sourcing_lnum - sourcing_lnum_off - 1;
+ sourcing_lnum_off = get_sourced_lnum(eap->getline, eap->cookie);
+ if (sourcing_lnum < sourcing_lnum_off)
+ sourcing_lnum_off -= sourcing_lnum;
else
sourcing_lnum_off = 0;
@@ -2670,7 +2674,7 @@ ex_function(exarg_T *eap)
fp->uf_flags = flags;
fp->uf_calls = 0;
fp->uf_script_ctx = current_sctx;
- fp->uf_script_ctx.sc_lnum += sourcing_lnum - newlines.ga_len - 1;
+ fp->uf_script_ctx.sc_lnum += sourcing_lnum_top;
goto ret_free;
erret: