mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
Merge pull request #23864 from folke/nvim_win_set_height
fix(api): dont change curwin for nvim_win_set_height
This commit is contained in:
commit
72300feecf
@ -167,13 +167,8 @@ void nvim_win_set_height(Window window, Integer height, Error *err)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
win_T *savewin = curwin;
|
|
||||||
curwin = win;
|
|
||||||
curbuf = curwin->w_buffer;
|
|
||||||
try_start();
|
try_start();
|
||||||
win_setheight((int)height);
|
win_setheight_win((int)height, win);
|
||||||
curwin = savewin;
|
|
||||||
curbuf = curwin->w_buffer;
|
|
||||||
try_end(err);
|
try_end(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,13 +209,8 @@ void nvim_win_set_width(Window window, Integer width, Error *err)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
win_T *savewin = curwin;
|
|
||||||
curwin = win;
|
|
||||||
curbuf = curwin->w_buffer;
|
|
||||||
try_start();
|
try_start();
|
||||||
win_setwidth((int)width);
|
win_setwidth_win((int)width, win);
|
||||||
curwin = savewin;
|
|
||||||
curbuf = curwin->w_buffer;
|
|
||||||
try_end(err);
|
try_end(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,6 +285,22 @@ describe('API/win', function()
|
|||||||
eq(2, window('get_height', nvim('list_wins')[2]))
|
eq(2, window('get_height', nvim('list_wins')[2]))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('correctly handles height=1', function()
|
||||||
|
nvim('command', 'split')
|
||||||
|
nvim('set_current_win', nvim('list_wins')[1])
|
||||||
|
window('set_height', nvim('list_wins')[2], 1)
|
||||||
|
eq(1, window('get_height', nvim('list_wins')[2]))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('correctly handles height=1 with a winbar', function()
|
||||||
|
nvim('command', 'set winbar=foobar')
|
||||||
|
nvim('command', 'set winminheight=0')
|
||||||
|
nvim('command', 'split')
|
||||||
|
nvim('set_current_win', nvim('list_wins')[1])
|
||||||
|
window('set_height', nvim('list_wins')[2], 1)
|
||||||
|
eq(1, window('get_height', nvim('list_wins')[2]))
|
||||||
|
end)
|
||||||
|
|
||||||
it('do not cause ml_get errors with foldmethod=expr #19989', function()
|
it('do not cause ml_get errors with foldmethod=expr #19989', function()
|
||||||
insert([[
|
insert([[
|
||||||
aaaaa
|
aaaaa
|
||||||
|
Loading…
Reference in New Issue
Block a user