Patch 9.0.1044
Problem:    Setting window height using Python may cause errors.
Solution:   When setting "curwin" also set "curbuf". (closes #11687)
Files:      src/if_py_both.h, src/testdir/test_python3.vim


*** ../vim-9.0.1043/src/if_py_both.h    2022-12-08 15:32:11.083034191 +0000
--- src/if_py_both.h    2022-12-10 11:15:57.834222926 +0000
***************
*** 4081,4090 ****
--- 4081,4092 ----
  #endif
        savewin = curwin;
        curwin = self->win;
+       curbuf = curwin->w_buffer;
  
        VimTryStart();
        win_setheight((int) height);
        curwin = savewin;
+       curbuf = curwin->w_buffer;
        if (VimTryEnd())
            return -1;
  
***************
*** 4103,4112 ****
--- 4105,4116 ----
  #endif
        savewin = curwin;
        curwin = self->win;
+       curbuf = curwin->w_buffer;
  
        VimTryStart();
        win_setwidth((int) width);
        curwin = savewin;
+       curbuf = curwin->w_buffer;
        if (VimTryEnd())
            return -1;
  
*** ../vim-9.0.1043/src/testdir/test_python3.vim        2022-09-30 
21:57:07.547153409 +0100
--- src/testdir/test_python3.vim        2022-12-10 11:14:56.746215664 +0000
***************
*** 540,545 ****
--- 540,563 ----
    %bw!
  endfunc
  
+ " This was causing trouble because "curbuf" was not matching curwin->w_buffer
+ func Test_python3_window_set_height()
+   enew!
+   call setline(1, ['aaa', 'bbb', 'ccc'])
+   call cursor(2, 1)
+   set foldmethod=expr
+   new
+   wincmd w
+   python3 vim.windows[0].height = 5
+   call assert_equal(5, winheight(1))
+ 
+   call feedkeys('j', 'xt')
+   call assert_equal(3, getpos('.')[1])
+ 
+   bwipe!
+   bwipe!
+ endfunc
+ 
  " Test for the python List object
  func Test_python3_list()
    " Try to convert a null List
*** ../vim-9.0.1043/src/version.c       2022-12-10 10:22:25.873096527 +0000
--- src/version.c       2022-12-10 11:16:23.530225875 +0000
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1044,
  /**/

-- 
       Bravely bold Sir Robin, rode forth from Camelot,
       He was not afraid to die, Oh Brave Sir Robin,
       He was not at all afraid to be killed in nasty ways
       Brave, brave, brave, brave Sir Robin.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20221210111810.6B7411C1742%40moolenaar.net.

Raspunde prin e-mail lui