Patch 8.2.3468
Problem:    Problem with :cd when editing file in non-existent directory. (Yee
            Cheng Chin)
Solution:   Prepend the current directory to get the full path. (closes #8903)
Files:      src/os_unix.c, src/testdir/test_cd.vim


*** ../vim-8.2.3467/src/os_unix.c       2021-08-30 20:26:12.860831195 +0100
--- src/os_unix.c       2021-10-03 19:24:20.656125677 +0100
***************
*** 2647,2653 ****
                {
                    vim_strncpy(buf, fname, p - fname);
                    if (mch_chdir((char *)buf))
!                       retval = FAIL;
                    else if (*p == '/')
                        fname = p + 1;
                    else
--- 2647,2661 ----
                {
                    vim_strncpy(buf, fname, p - fname);
                    if (mch_chdir((char *)buf))
!                   {
!                       // Path does not exist (yet).  For a full path fail,
!                       // will use the path as-is.  For a relative path use
!                       // the current directory and append the file name.
!                       if (mch_isFullName(fname))
!                           retval = FAIL;
!                       else
!                           p = NULL;
!                   }
                    else if (*p == '/')
                        fname = p + 1;
                    else
*** ../vim-8.2.3467/src/testdir/test_cd.vim     2021-07-10 16:59:44.679330992 
+0100
--- src/testdir/test_cd.vim     2021-10-03 19:22:24.427445390 +0100
***************
*** 208,211 ****
--- 208,228 ----
    call delete('XComplFile')
  endfunc
  
+ func Test_cd_unknown_dir()
+   call mkdir('Xa')
+   cd Xa
+   call writefile(['text'], 'Xb.txt')
+   edit Xa/Xb.txt
+   let first_buf = bufnr()
+   cd ..
+   edit
+   call assert_equal(first_buf, bufnr())
+   edit Xa/Xb.txt
+   call assert_notequal(first_buf, bufnr())
+ 
+   bwipe!
+   exe "bwipe! " .. first_buf
+   call delete('Xa', 'rf')
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3467/src/version.c       2021-10-03 16:22:01.963285362 +0100
--- src/version.c       2021-10-03 19:03:12.566162614 +0100
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3468,
  /**/

-- 
Bare feet magnetize sharp metal objects so they point upward from the
floor -- especially in the dark.

 /// 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/20211003183017.6BE64C80053%40pakwach.

Raspunde prin e-mail lui