Mercurial > vim
comparison src/vim9execute.c @ 24952:ffe784fdec57 v8.2.3013
patch 8.2.3013: Vim: when debugging only first line of command is displayed
Commit: https://github.com/vim/vim/commit/4cea536bdf48df459e7ad651dfee006844bbf2c0
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 16 22:24:40 2021 +0200
patch 8.2.3013: Vim: when debugging only first line of command is displayed
Problem: Vim: when debugging only the first line of a command using line
continuation is displayed.
Solution: Find the next command and concatenate lines until that one.
(closes #8392)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 16 Jun 2021 22:30:03 +0200 |
parents | 5c418c774f95 |
children | 9b7fac4c70a0 |
comparison
equal
deleted
inserted
replaced
24951:8972f6de0a40 | 24952:ffe784fdec57 |
---|---|
1429 - varargs_off + idx); | 1429 - varargs_off + idx); |
1430 if (ufunc->uf_va_name != NULL && STRCMP(ufunc->uf_va_name, name) == 0) | 1430 if (ufunc->uf_va_name != NULL && STRCMP(ufunc->uf_va_name, name) == 0) |
1431 return STACK_TV(ectx->ec_frame_idx - 1); | 1431 return STACK_TV(ectx->ec_frame_idx - 1); |
1432 | 1432 |
1433 return NULL; | 1433 return NULL; |
1434 } | |
1435 | |
1436 static void | |
1437 handle_debug(isn_T *iptr, ectx_T *ectx) | |
1438 { | |
1439 char_u *line; | |
1440 ufunc_T *ufunc = (((dfunc_T *)def_functions.ga_data) | |
1441 + ectx->ec_dfunc_idx)->df_ufunc; | |
1442 isn_T *ni; | |
1443 int end_lnum = iptr->isn_lnum; | |
1444 garray_T ga; | |
1445 int lnum; | |
1446 | |
1447 SOURCING_LNUM = iptr->isn_lnum; | |
1448 debug_context = ectx; | |
1449 debug_var_count = iptr->isn_arg.number; | |
1450 | |
1451 for (ni = iptr + 1; ni->isn_type != ISN_FINISH; ++ni) | |
1452 if (ni->isn_type == ISN_DEBUG | |
1453 || ni->isn_type == ISN_RETURN | |
1454 || ni->isn_type == ISN_RETURN_VOID) | |
1455 { | |
1456 end_lnum = ni->isn_lnum; | |
1457 break; | |
1458 } | |
1459 | |
1460 if (end_lnum > iptr->isn_lnum) | |
1461 { | |
1462 ga_init2(&ga, sizeof(char_u *), 10); | |
1463 for (lnum = iptr->isn_lnum; lnum < end_lnum; ++lnum) | |
1464 if (ga_grow(&ga, 1) == OK) | |
1465 ((char_u **)(ga.ga_data))[ga.ga_len++] = | |
1466 skipwhite(((char_u **)ufunc->uf_lines.ga_data)[lnum - 1]); | |
1467 line = ga_concat_strings(&ga, " "); | |
1468 vim_free(ga.ga_data); | |
1469 } | |
1470 else | |
1471 line = ((char_u **)ufunc->uf_lines.ga_data)[iptr->isn_lnum - 1]; | |
1472 if (line == NULL) | |
1473 line = (char_u *)"[empty]"; | |
1474 | |
1475 do_debug(line); | |
1476 debug_context = NULL; | |
1477 | |
1478 if (end_lnum > iptr->isn_lnum) | |
1479 vim_free(line); | |
1434 } | 1480 } |
1435 | 1481 |
1436 /* | 1482 /* |
1437 * Execute instructions in execution context "ectx". | 1483 * Execute instructions in execution context "ectx". |
1438 * Return OK or FAIL; | 1484 * Return OK or FAIL; |
4154 } | 4200 } |
4155 break; | 4201 break; |
4156 | 4202 |
4157 case ISN_DEBUG: | 4203 case ISN_DEBUG: |
4158 if (ex_nesting_level <= debug_break_level) | 4204 if (ex_nesting_level <= debug_break_level) |
4159 { | 4205 handle_debug(iptr, ectx); |
4160 char_u *line; | |
4161 ufunc_T *ufunc = (((dfunc_T *)def_functions.ga_data) | |
4162 + ectx->ec_dfunc_idx)->df_ufunc; | |
4163 | |
4164 SOURCING_LNUM = iptr->isn_lnum; | |
4165 debug_context = ectx; | |
4166 debug_var_count = iptr->isn_arg.number; | |
4167 line = ((char_u **)ufunc->uf_lines.ga_data)[ | |
4168 iptr->isn_lnum - 1]; | |
4169 if (line == NULL) | |
4170 line = (char_u *)"[empty]"; | |
4171 do_debug(line); | |
4172 debug_context = NULL; | |
4173 } | |
4174 break; | 4206 break; |
4175 | 4207 |
4176 case ISN_SHUFFLE: | 4208 case ISN_SHUFFLE: |
4177 { | 4209 { |
4178 typval_T tmp_tv; | 4210 typval_T tmp_tv; |