mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.1044: setting window height using Python may cause errors
Problem: Setting window height using Python may cause errors. Solution: When setting "curwin" also set "curbuf". (closes #11687)
This commit is contained in:
parent
c51a376265
commit
6c87bbb4e4
@ -4081,10 +4081,12 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
|
||||
#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,10 +4105,12 @@ WindowSetattr(WindowObject *self, char *name, PyObject *valObject)
|
||||
#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;
|
||||
|
||||
|
@ -540,6 +540,24 @@ func Test_python3_window()
|
||||
%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
|
||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1044,
|
||||
/**/
|
||||
1043,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user