Patch 8.2.4842

5 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 28, 2022, 2:09:38 PM4/28/22
to vim...@googlegroups.com

Patch 8.2.4842 (after 8.2.4841)
Problem: expand("%:p") is not empty when there is no buffer name.
Solution: When ignoring errors still return NULL. (closes #10311)
Files: src/ex_docmd.c, src/testdir/test_expand_func.vim


*** ../vim-8.2.4841/src/ex_docmd.c 2022-04-28 17:52:19.532130311 +0100
--- src/ex_docmd.c 2022-04-28 19:00:42.179646391 +0100
***************
*** 9349,9360 ****
}
}

! if (empty_is_error && (resultlen == 0 || valid != VALID_HEAD + VALID_PATH))
{
! if (valid != VALID_HEAD + VALID_PATH)
! *errormsg = _(e_empty_file_name_for_percent_or_hash_only_works_with_ph);
! else
! *errormsg = _(e_evaluates_to_an_empty_string);
result = NULL;
}
else
--- 9349,9363 ----
}
}

! if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH)
{
! if (empty_is_error)
! {
! if (valid != VALID_HEAD + VALID_PATH)
! *errormsg = _(e_empty_file_name_for_percent_or_hash_only_works_with_ph);
! else
! *errormsg = _(e_evaluates_to_an_empty_string);
! }
result = NULL;
}
else
*** ../vim-8.2.4841/src/testdir/test_expand_func.vim 2022-04-28 17:52:19.536130307 +0100
--- src/testdir/test_expand_func.vim 2022-04-28 19:06:24.591350869 +0100
***************
*** 82,88 ****

func Test_expand()
new
! call assert_equal("''", expand('%:S'))
call assert_equal('3', '<slnum>'->expand())
call assert_equal(['4'], expand('<slnum>', v:false, v:true))
" Don't add any line above this, otherwise <slnum> will change.
--- 82,88 ----

func Test_expand()
new
! call assert_equal("", expand('%:S'))
call assert_equal('3', '<slnum>'->expand())
call assert_equal(['4'], expand('<slnum>', v:false, v:true))
" Don't add any line above this, otherwise <slnum> will change.
***************
*** 90,95 ****
--- 90,96 ----
set verbose=1
call assert_equal("", expand('%'))
set verbose=0
+ call assert_equal("", expand('%:p'))
quit
endfunc

*** ../vim-8.2.4841/src/version.c 2022-04-28 17:52:19.536130307 +0100
--- src/version.c 2022-04-28 19:08:01.703262445 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4842,
/**/

--
From "know your smileys":
:----} You lie like Pinocchio

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages