diff src/vim9execute.c @ 24960:64b70a958f19 v8.2.3017

patch 8.2.3017: Vim9: debugger shows too many lines Commit: https://github.com/vim/vim/commit/59b50c3bee908694ae4ac10b26bfebf99d09d466 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 17 22:27:48 2021 +0200 patch 8.2.3017: Vim9: debugger shows too many lines Problem: Vim9: debugger shows too many lines. Solution: Truncate at a comment, "enddef", etc. (closes https://github.com/vim/vim/issues/8392)
author Bram Moolenaar <Bram@vim.org>
date Thu, 17 Jun 2021 22:30:03 +0200
parents d0b6a8d82cef
children 2818b8108d92
line wrap: on
line diff
--- 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);
     }