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 -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220428180933.8EEBF1C16E8%40moolenaar.net.

Raspunde prin e-mail lui