neovim

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

commit d6a6adf7082909d555914d85cac0a47d218d7b64
parent ed65724e57d2af13cedc380ecfe4a495dae3afb7
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Sun, 14 Aug 2022 07:18:06 +0800

vim-patch:8.2.1658: expand('<stack>') has trailing ".."

Problem:    Expand('<stack>') has trailing "..".
Solution:   Remove the "..". (closes vim/vim#6927)
https://github.com/vim/vim/commit/a810db3f17d477e057059c72062c08fd97bcea43

Diffstat:
Msrc/nvim/runtime.c | 16+++++++---------
Msrc/nvim/testdir/test_expand_func.vim | 2+-
2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c @@ -135,21 +135,19 @@ char *estack_sfile(estack_arg_T which) } len += strlen(type_name); ga_grow(&ga, (int)len); - linenr_T lnum = 0; - if (idx == exestack.ga_len - 1) { - lnum = which == ESTACK_STACK ? SOURCING_LNUM : 0; - } else { - lnum = entry->es_lnum; - } + 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, idx == exestack.ga_len - 1 ? "" : ".."); + type_name, entry->es_name, dots); } else { - vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s[%" PRIdLINENR "]..", - type_name, entry->es_name, lnum); + vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s[%" PRIdLINENR "]%s", + type_name, entry->es_name, lnum, dots); } ga.ga_len += (int)strlen((char *)ga.ga_data + ga.ga_len); } diff --git a/src/nvim/testdir/test_expand_func.vim b/src/nvim/testdir/test_expand_func.vim @@ -58,7 +58,7 @@ func Test_expand_sfile_and_stack() END call writefile(lines, 'Xstack') source Xstack - call assert_match('\<Xstack\[2\]', g:stack_value) + call assert_match('\<Xstack\[2\]$', g:stack_value) call delete('Xstack') endfunc