diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-11 17:59:23 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-11 17:59:23 +0200 |
commit | a810db3f17d477e057059c72062c08fd97bcea43 (patch) | |
tree | ae8d634adb67382b2f884510a1bc9428a1fc1b83 | |
parent | 8b848cafb0a88f8d8e8f46caa8d67431b4faa374 (diff) |
patch 8.2.1658: expand('<stack>') has trailing ".."v8.2.1658
Problem: Expand('<stack>') has trailing "..".
Solution: Remove the "..". (closes #6927)
-rw-r--r-- | src/scriptfile.c | 11 | ||||
-rw-r--r-- | src/testdir/test_expand_func.vim | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/scriptfile.c b/src/scriptfile.c index 75182ca511..a8e67b98ad 100644 --- a/src/scriptfile.c +++ b/src/scriptfile.c @@ -144,7 +144,8 @@ estack_sfile(estack_arg_T which UNUSED) entry = ((estack_T *)exestack.ga_data) + idx; if (entry->es_name != NULL) { - long lnum = 0; + long lnum = 0; + char *dots; len = STRLEN(entry->es_name) + 15; type_name = ""; @@ -165,16 +166,16 @@ estack_sfile(estack_arg_T which UNUSED) lnum = which == ESTACK_STACK ? SOURCING_LNUM : 0; else lnum = entry->es_lnum; + 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[%ld]..", - type_name, entry->es_name, lnum); + vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s[%ld]%s", + type_name, entry->es_name, lnum, dots); ga.ga_len += (int)STRLEN((char *)ga.ga_data + ga.ga_len); } } diff --git a/src/testdir/test_expand_func.vim b/src/testdir/test_expand_func.vim index a63cc04e1f..3c430e1c61 100644 --- a/src/testdir/test_expand_func.vim +++ b/src/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 diff --git a/src/version.c b/src/version.c index 5386822034..81c51e1964 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1658, +/**/ 1657, /**/ 1656, |