neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 53fd3657ccf50046f095e90f44ef4c34e2e2f6d5
parent 02def1a32ef7acb6b7d940193815ba06e3775ecf
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Tue, 16 Dec 2025 08:07:47 +0800

vim-patch:9.0.1758: vim9 no class identifiers in stack dumps

Problem:  vim9 no class identifiers in stack dumps
Solution: Prefix class members in stack traces with the class name
          followed by a dot.

closes: vim/vim#12866
closes: vim/vim#12078

https://github.com/vim/vim/commit/0ffc17aa479867f6f3ee14a46cf71352f126b5ba

Co-authored-by: LemonBoy <thatlemon@gmail.com>

Diffstat:
Msrc/nvim/runtime.c | 27+++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c @@ -195,7 +195,6 @@ char *estack_sfile(estack_arg_T which) for (int idx = 0; idx < exestack.ga_len; idx++) { entry = ((estack_T *)exestack.ga_data) + idx; if (entry->es_name != NULL) { - size_t len = strlen(entry->es_name) + 15; char *type_name = ""; if (entry->es_type != last_type) { switch (entry->es_type) { @@ -208,26 +207,26 @@ char *estack_sfile(estack_arg_T which) } last_type = entry->es_type; } - len += strlen(type_name); - ga_grow(&ga, (int)len); linenr_T lnum = idx == exestack.ga_len - 1 ? which == ESTACK_STACK ? SOURCING_LNUM : 0 : entry->es_lnum; - char *dots = idx == exestack.ga_len - 1 ? "" : ".."; - if (lnum == 0) { - // For the bottom entry of <sfile>: do not add the line number, - // it is used in <slnum>. Also leave it out when the number is - // not set. - vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s%s", - type_name, entry->es_name, dots); - } else { - vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s[%" PRIdLINENR "]%s", - type_name, entry->es_name, lnum, dots); + size_t len = strlen(entry->es_name) + strlen(type_name) + 26; + ga_grow(&ga, (int)len); + ga_concat(&ga, type_name); + ga_concat(&ga, entry->es_name); + // For the bottom entry of <sfile>: do not add the line number, it is used in + // <slnum>. Also leave it out when the number is not set. + if (lnum != 0) { + ga.ga_len += vim_snprintf((char *)ga.ga_data + ga.ga_len, 23, + "[%" PRIdLINENR "]", lnum); + } + if (idx != exestack.ga_len - 1) { + ga_concat(&ga, ".."); } - ga.ga_len += (int)strlen((char *)ga.ga_data + ga.ga_len); } } + ga_append(&ga, '\0'); return (char *)ga.ga_data; }