comparison src/ex_docmd.c @ 28637:5cf6dee0f305 v8.2.4842

patch 8.2.4842: expand("%:p") is not empty when there is no buffer name Commit: https://github.com/vim/vim/commit/211a5bb2353c66684f38527184a258921f95c9d9 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 28 19:09:03 2022 +0100 patch 8.2.4842: expand("%:p") is not empty when there is no buffer name Problem: expand("%:p") is not empty when there is no buffer name. Solution: When ignoring errors still return NULL. (closes https://github.com/vim/vim/issues/10311)
author Bram Moolenaar <Bram@vim.org>
date Thu, 28 Apr 2022 20:15:03 +0200
parents dfe18756f2ad
children 930f1bb1649d
comparison
equal deleted inserted replaced
28636:ba9fa3a26a17 28637:5cf6dee0f305
9347 return NULL; 9347 return NULL;
9348 } 9348 }
9349 } 9349 }
9350 } 9350 }
9351 9351
9352 if (empty_is_error && (resultlen == 0 || valid != VALID_HEAD + VALID_PATH)) 9352 if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH)
9353 { 9353 {
9354 if (valid != VALID_HEAD + VALID_PATH) 9354 if (empty_is_error)
9355 *errormsg = _(e_empty_file_name_for_percent_or_hash_only_works_with_ph); 9355 {
9356 else 9356 if (valid != VALID_HEAD + VALID_PATH)
9357 *errormsg = _(e_evaluates_to_an_empty_string); 9357 *errormsg = _(e_empty_file_name_for_percent_or_hash_only_works_with_ph);
9358 else
9359 *errormsg = _(e_evaluates_to_an_empty_string);
9360 }
9358 result = NULL; 9361 result = NULL;
9359 } 9362 }
9360 else 9363 else
9361 result = vim_strnsave(result, resultlen); 9364 result = vim_strnsave(result, resultlen);
9362 vim_free(resultbuf); 9365 vim_free(resultbuf);