summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-06-17 22:27:48 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-17 22:27:48 +0200
commit59b50c3bee908694ae4ac10b26bfebf99d09d466 (patch)
tree0dbb7bdcf646242341a1ead0465439b8e7653ff8
parentfae55a9cb0838e4c2e634e55a3468af4a75fbdf2 (diff)
patch 8.2.3017: Vim9: debugger shows too many linesv8.2.3017
Problem: Vim9: debugger shows too many lines. Solution: Truncate at a comment, "enddef", etc. (closes #8392)
-rw-r--r--src/testdir/test_debugger.vim5
-rw-r--r--src/version.c2
-rw-r--r--src/vim9execute.c12
3 files changed, 17 insertions, 2 deletions
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim
index a6e3966096..411909d1c7 100644
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -958,6 +958,10 @@ func Test_debug_def_function()
a: 1,
b: 2,
}
+ # comment
+ def Inner()
+ eval 1
+ enddef
enddef
END
call writefile(file, 'Xtest.vim')
@@ -997,6 +1001,7 @@ func Test_debug_def_function()
\ ':debug call FuncWithDict()',
\ ['cmd: call FuncWithDict()'])
call RunDbgCmd(buf, 'step', ['line 1: var d = { a: 1, b: 2, }'])
+ call RunDbgCmd(buf, 'step', ['line 6: def Inner()'])
call RunDbgCmd(buf, 'cont')
call StopVimInTerminal(buf)
diff --git a/src/version.c b/src/version.c
index a03b3fe13c..69aa0e7f59 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3017,
+/**/
3016,
/**/
3015,
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 2577e63e27..218357a825 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1461,9 +1461,17 @@ handle_debug(isn_T *iptr, ectx_T *ectx)
{
ga_init2(&ga, sizeof(char_u *), 10);
for (lnum = iptr->isn_lnum; lnum < end_lnum; ++lnum)
+ {
+ char_u *p = skipwhite(
+ ((char_u **)ufunc->uf_lines.ga_data)[lnum - 1]);
+
+ if (*p == '#')
+ break;
if (ga_grow(&ga, 1) == OK)
- ((char_u **)(ga.ga_data))[ga.ga_len++] =
- skipwhite(((char_u **)ufunc->uf_lines.ga_data)[lnum - 1]);
+ ((char_u **)(ga.ga_data))[ga.ga_len++] = p;
+ if (STRNCMP(p, "def ", 4) == 0)
+ break;
+ }
line = ga_concat_strings(&ga, " ");
vim_free(ga.ga_data);
}