comparison src/scriptfile.c @ 22218:195a617b405a v8.2.1658

patch 8.2.1658: expand('<stack>') has trailing ".." Commit: https://github.com/vim/vim/commit/a810db3f17d477e057059c72062c08fd97bcea43 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 11 17:59:23 2020 +0200 patch 8.2.1658: expand('<stack>') has trailing ".." Problem: Expand('<stack>') has trailing "..". Solution: Remove the "..". (closes https://github.com/vim/vim/issues/6927)
author Bram Moolenaar <Bram@vim.org>
date Fri, 11 Sep 2020 18:00:03 +0200
parents a607f02fd17a
children 209c7aa56325
comparison
equal deleted inserted replaced
22217:50b1e250f302 22218:195a617b405a
142 for (idx = 0; idx < exestack.ga_len; ++idx) 142 for (idx = 0; idx < exestack.ga_len; ++idx)
143 { 143 {
144 entry = ((estack_T *)exestack.ga_data) + idx; 144 entry = ((estack_T *)exestack.ga_data) + idx;
145 if (entry->es_name != NULL) 145 if (entry->es_name != NULL)
146 { 146 {
147 long lnum = 0; 147 long lnum = 0;
148 char *dots;
148 149
149 len = STRLEN(entry->es_name) + 15; 150 len = STRLEN(entry->es_name) + 15;
150 type_name = ""; 151 type_name = "";
151 if (entry->es_type != last_type) 152 if (entry->es_type != last_type)
152 { 153 {
163 break; 164 break;
164 if (idx == exestack.ga_len - 1) 165 if (idx == exestack.ga_len - 1)
165 lnum = which == ESTACK_STACK ? SOURCING_LNUM : 0; 166 lnum = which == ESTACK_STACK ? SOURCING_LNUM : 0;
166 else 167 else
167 lnum = entry->es_lnum; 168 lnum = entry->es_lnum;
169 dots = idx == exestack.ga_len - 1 ? "" : "..";
168 if (lnum == 0) 170 if (lnum == 0)
169 // For the bottom entry of <sfile>: do not add the line number, 171 // For the bottom entry of <sfile>: do not add the line number,
170 // it is used in <slnum>. Also leave it out when the number is 172 // it is used in <slnum>. Also leave it out when the number is
171 // not set. 173 // not set.
172 vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s%s", 174 vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s%s",
173 type_name, entry->es_name, 175 type_name, entry->es_name, dots);
174 idx == exestack.ga_len - 1 ? "" : "..");
175 else 176 else
176 vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s[%ld]..", 177 vim_snprintf((char *)ga.ga_data + ga.ga_len, len, "%s%s[%ld]%s",
177 type_name, entry->es_name, lnum); 178 type_name, entry->es_name, lnum, dots);
178 ga.ga_len += (int)STRLEN((char *)ga.ga_data + ga.ga_len); 179 ga.ga_len += (int)STRLEN((char *)ga.ga_data + ga.ga_len);
179 } 180 }
180 } 181 }
181 182
182 return (char_u *)ga.ga_data; 183 return (char_u *)ga.ga_data;