aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/test_window_cmd.vim8
-rw-r--r--src/nvim/window.c2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_window_cmd.vim b/src/nvim/testdir/test_window_cmd.vim
index c630e678fd..bed39d0741 100644
--- a/src/nvim/testdir/test_window_cmd.vim
+++ b/src/nvim/testdir/test_window_cmd.vim
@@ -850,6 +850,14 @@ func Test_window_resize()
exe other_winnr .. 'resize +1'
call assert_equal(12, winheight(other_winnr))
call assert_equal(&lines - 10 - 3 -2, winheight(0))
+ close
+
+ vsplit
+ wincmd l
+ let other_winnr = winnr('h')
+ call assert_notequal(winnr(), other_winnr)
+ exe 'vert ' .. other_winnr .. 'resize -100'
+ call assert_equal(0, winwidth(other_winnr))
%bwipe!
endfunc
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 2dcce2d8cb..00f49724b6 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5349,6 +5349,8 @@ void win_setwidth_win(int width, win_T *wp)
width = p_wmw;
if (width == 0)
width = 1;
+ } else if (width < 0) {
+ width = 0;
}
if (wp->w_floating) {
wp->w_float_config.width = width;