]> granicus.if.org Git - vim/commitdiff
patch 8.2.3017: Vim9: debugger shows too many lines v8.2.3017
authorBram Moolenaar <Bram@vim.org>
Thu, 17 Jun 2021 20:27:48 +0000 (22:27 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 17 Jun 2021 20:27:48 +0000 (22:27 +0200)
Problem:    Vim9: debugger shows too many lines.
Solution:   Truncate at a comment, "enddef", etc. (closes #8392)

src/testdir/test_debugger.vim
src/version.c
src/vim9execute.c

index a6e3966096e8a5fcc17e7c69387f1b3e957d8f33..411909d1c7dbbc93a06063165f73320105935638 100644 (file)
@@ -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)
index a03b3fe13c368249f1f8746ee33ee6b4ef9b505d..69aa0e7f59f1713981ce80d7e05b3da11c12d620 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3017,
 /**/
     3016,
 /**/
index 2577e63e2761e79bed36dcb5dc28a90258529f66..218357a825b28ca8515596248632bf0c4c6838e9 100644 (file)
@@ -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);
     }