Patch 9.0.0261
Problem:    bufload() reads a file even if the name is not a file name. (Cyker
            Way)
Solution:   Do not read the file when the buffer name is not a file name.
            (closes #10975)
Files:      runtime/doc/builtin.txt, src/buffer.c,
            src/testdir/test_functions.vim


*** ../vim-9.0.0260/runtime/doc/builtin.txt     2022-08-24 16:30:30.686752454 
+0100
--- runtime/doc/builtin.txt     2022-08-25 12:35:19.813726652 +0100
***************
*** 1179,1185 ****
                browsing is not possible, an empty string is returned.
  
  bufadd({name})                                                *bufadd()*
!               Add a buffer to the buffer list with String {name}.
                If a buffer for file {name} already exists, return that buffer
                number.  Otherwise return the buffer number of the newly
                created buffer.  When {name} is an empty string then a new
--- 1179,1186 ----
                browsing is not possible, an empty string is returned.
  
  bufadd({name})                                                *bufadd()*
!               Add a buffer to the buffer list with name {name} (must be a
!               String).
                If a buffer for file {name} already exists, return that buffer
                number.  Otherwise return the buffer number of the newly
                created buffer.  When {name} is an empty string then a new
***************
*** 1232,1238 ****
                Ensure the buffer {buf} is loaded.  When the buffer name
                refers to an existing file then the file is read.  Otherwise
                the buffer will be empty.  If the buffer was already loaded
!               then there is no change.
                If there is an existing swap file for the file of the buffer,
                there will be no dialog, the buffer will be loaded anyway.
                The {buf} argument is used like with |bufexists()|.
--- 1233,1240 ----
                Ensure the buffer {buf} is loaded.  When the buffer name
                refers to an existing file then the file is read.  Otherwise
                the buffer will be empty.  If the buffer was already loaded
!               then there is no change.  If the buffer is not related to a
!               file the no file is read (e.g., when 'buftype' is "nofile").
                If there is an existing swap file for the file of the buffer,
                there will be no dialog, the buffer will be loaded anyway.
                The {buf} argument is used like with |bufexists()|.
*** ../vim-9.0.0260/src/buffer.c        2022-08-22 15:19:12.728328961 +0100
--- src/buffer.c        2022-08-25 12:34:17.458110650 +0100
***************
*** 220,226 ****
--- 220,229 ----
      // mark cursor position as being invalid
      curwin->w_valid = 0;
  
+     // Read the file if there is one.
      if (curbuf->b_ffname != NULL
+           && !bt_quickfix(curbuf)
+           && !bt_nofilename(curbuf)
  #ifdef FEAT_NETBEANS_INTG
            && netbeansReadFile
  #endif
*** ../vim-9.0.0260/src/testdir/test_functions.vim      2022-06-30 
11:03:36.048634818 +0100
--- src/testdir/test_functions.vim      2022-08-25 12:43:31.867356345 +0100
***************
*** 2368,2373 ****
--- 2368,2380 ----
    exe 'bwipe ' .. buf2
    call assert_equal(0, bufexists(buf2))
  
+   " when 'buftype' is "nofile" then bufload() does not read the file
+   bwipe! XotherName
+   let buf = bufadd('XotherName')
+   call setbufvar(buf, '&bt', 'nofile')
+   call bufload(buf)
+   call assert_equal([''], getbufline(buf, 1, '$'))
+ 
    bwipe someName
    bwipe XotherName
    call assert_equal(0, bufexists('someName'))
*** ../vim-9.0.0260/src/version.c       2022-08-24 20:07:19.342558427 +0100
--- src/version.c       2022-08-25 12:44:22.287158139 +0100
***************
*** 733,734 ****
--- 733,736 ----
  {   /* Add new patch number below this line */
+ /**/
+     261,
  /**/

-- 
Q: Why does /dev/null accept only integers?
A: You can't sink a float.

 /// 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/20220825114559.5468D1C090E%40moolenaar.net.

Raspunde prin e-mail lui