Patch 9.0.0274 (after 9.0.0261)
Problem:    Netrw plugin does not show remote files.
Solution:   Do read a file when 'buftype' is "acwrite". (closes #10983)
Files:      src/buffer.c, src/testdir/test_functions.vim


*** ../vim-9.0.0273/src/buffer.c        2022-08-26 11:54:58.385177821 +0100
--- src/buffer.c        2022-08-26 12:54:51.733845729 +0100
***************
*** 48,54 ****
  static int    append_arg_number(win_T *wp, char_u *buf, int buflen, int 
add_file);
  static void   free_buffer(buf_T *);
  static void   free_buffer_stuff(buf_T *buf, int free_options);
! static void   clear_wininfo(buf_T *buf);
  
  #ifdef UNIX
  # define dev_T dev_t
--- 48,54 ----
  static int    append_arg_number(win_T *wp, char_u *buf, int buflen, int 
add_file);
  static void   free_buffer(buf_T *);
  static void   free_buffer_stuff(buf_T *buf, int free_options);
! static int    bt_nofileread(buf_T *buf);
  
  #ifdef UNIX
  # define dev_T dev_t
***************
*** 223,229 ****
  
      // A buffer without an actual file should not use the buffer name to read 
a
      // file.
!     if (bt_quickfix(curbuf) || bt_nofilename(curbuf))
        flags |= READ_NOFILE;
  
      // Read the file if there is one.
--- 223,229 ----
  
      // A buffer without an actual file should not use the buffer name to read 
a
      // file.
!     if (bt_nofileread(curbuf))
        flags |= READ_NOFILE;
  
      // Read the file if there is one.
***************
*** 978,983 ****
--- 978,999 ----
  }
  
  /*
+  * Free the b_wininfo list for buffer "buf".
+  */
+     static void
+ clear_wininfo(buf_T *buf)
+ {
+     wininfo_T *wip;
+ 
+     while (buf->b_wininfo != NULL)
+     {
+       wip = buf->b_wininfo;
+       buf->b_wininfo = wip->wi_next;
+       free_wininfo(wip);
+     }
+ }
+ 
+ /*
   * Free stuff in the buffer for ":bdel" and when wiping out the buffer.
   */
      static void
***************
*** 1036,1057 ****
  }
  
  /*
-  * Free the b_wininfo list for buffer "buf".
-  */
-     static void
- clear_wininfo(buf_T *buf)
- {
-     wininfo_T *wip;
- 
-     while (buf->b_wininfo != NULL)
-     {
-       wip = buf->b_wininfo;
-       buf->b_wininfo = wip->wi_next;
-       free_wininfo(wip);
-     }
- }
- 
- /*
   * Go to another buffer.  Handles the result of the ATTENTION dialog.
   */
      void
--- 1052,1057 ----
***************
*** 5709,5715 ****
  
  /*
   * Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt"
!  * buffer.  This means the buffer name is not a file name.
   */
      int
  bt_nofilename(buf_T *buf)
--- 5709,5716 ----
  
  /*
   * Return TRUE if "buf" is a "nofile", "acwrite", "terminal" or "prompt"
!  * buffer.  This means the buffer name may not be a file name, at least not 
for
!  * writing the buffer.
   */
      int
  bt_nofilename(buf_T *buf)
***************
*** 5720,5725 ****
--- 5721,5739 ----
            || buf->b_p_bt[0] == 'p');
  }
  
+ /*
+  * Return TRUE if "buf" is a "nofile", "quickfix", "terminal" or "prompt"
+  * buffer.  This means the buffer is not to be read from a file.
+  */
+     static int
+ bt_nofileread(buf_T *buf)
+ {
+     return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
+           || buf->b_p_bt[0] == 't'
+           || buf->b_p_bt[0] == 'q'
+           || buf->b_p_bt[0] == 'p');
+ }
+ 
  #if defined(FEAT_QUICKFIX) || defined(PROTO)
  /*
   * Return TRUE if "buf" has 'buftype' set to "nofile".
*** ../vim-9.0.0273/src/testdir/test_functions.vim      2022-08-25 
12:45:17.838946073 +0100
--- src/testdir/test_functions.vim      2022-08-26 12:56:38.057737657 +0100
***************
*** 2375,2380 ****
--- 2375,2387 ----
    call bufload(buf)
    call assert_equal([''], getbufline(buf, 1, '$'))
  
+   " when 'buftype' is "acwrite" then bufload() DOES read the file
+   bwipe! XotherName
+   let buf = bufadd('XotherName')
+   call setbufvar(buf, '&bt', 'acwrite')
+   call bufload(buf)
+   call assert_equal(['some', 'text'], getbufline(buf, 1, '$'))
+ 
    bwipe someName
    bwipe XotherName
    call assert_equal(0, bufexists('someName'))
*** ../vim-9.0.0273/src/version.c       2022-08-26 12:26:04.546865218 +0100
--- src/version.c       2022-08-26 12:57:30.445852141 +0100
***************
*** 725,726 ****
--- 725,728 ----
  {   /* Add new patch number below this line */
+ /**/
+     274,
  /**/

-- 
Biting someone with your natural teeth is "simple assault," while biting
someone with your false teeth is "aggravated assault."
                [real standing law in Louisana, United States of America]

 /// 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/20220826115908.251951C090E%40moolenaar.net.

Raspunde prin e-mail lui