Patch 8.2.2271
Problem:    ml_get error when changing hidden buffer in Python.
Solution:   Block updating folds. (closes #7598)
Files:      src/evalbuffer.c, src/testdir/test_python3.vim


*** ../vim-8.2.2270/src/evalbuffer.c    2020-10-22 18:23:34.429289412 +0200
--- src/evalbuffer.c    2021-01-02 13:48:38.246917302 +0100
***************
*** 807,812 ****
--- 807,815 ----
  switch_buffer(bufref_T *save_curbuf, buf_T *buf)
  {
      block_autocmds();
+ #ifdef FEAT_FOLDING
+     ++disable_fold_update;
+ #endif
      set_bufref(save_curbuf, curbuf);
      --curbuf->b_nwindows;
      curbuf = buf;
***************
*** 821,826 ****
--- 824,832 ----
  restore_buffer(bufref_T *save_curbuf)
  {
      unblock_autocmds();
+ #ifdef FEAT_FOLDING
+     --disable_fold_update;
+ #endif
      // Check for valid buffer, just in case.
      if (bufref_valid(save_curbuf))
      {
*** ../vim-8.2.2270/src/testdir/test_python3.vim        2020-12-22 
12:50:07.368223959 +0100
--- src/testdir/test_python3.vim        2021-01-02 13:46:35.735351774 +0100
***************
*** 4016,4019 ****
--- 4016,4052 ----
    sunmap <Esc>@
  endfunc
  
+ func Test_python3_fold_hidden_buffer()
+   CheckFeature folding
+ 
+   set fdm=expr fde=Fde(v:lnum)
+   let b:regex = '^'
+   func Fde(lnum)
+     let ld = [{}]
+     let lines = bufnr('%')->getbufline(1, '$')
+     let was_import = 0
+     for lnum in range(1, len(lines))
+       let line = lines[lnum]
+       call add(ld, {'a': b:regex})
+       let ld[lnum].foldexpr = was_import ? 1 : '>1'
+       let was_import = 1
+     endfor
+     return ld[a:lnum].foldexpr
+   endfunc
+ 
+   call setline(1, repeat([''], 15) + repeat(['from'], 3))
+   eval repeat(['x'], 17)->writefile('Xa.txt')
+   split Xa.txt
+   py3 import vim
+   py3 b = vim.current.buffer
+   py3 aaa = b[:]
+   hide
+   py3 b[:] = aaa
+ 
+   call delete('Xa.txt')
+   set fdm& fde&
+   delfunc Fde
+   bwipe! Xa.txt
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2270/src/version.c       2021-01-02 12:45:38.234364061 +0100
--- src/version.c       2021-01-02 13:48:02.691043639 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2271,
  /**/

-- 
>From "know your smileys":
 :^[/   mean-smiley-with-cigarette

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            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/202101021303.102D3guZ1825595%40masaka.moolenaar.net.

Raspunde prin e-mail lui