summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-12-29 12:46:51 +0100
committerBram Moolenaar <Bram@vim.org>2020-12-29 12:46:51 +0100
commit89015a675990bd7d70e041c5d890edb803b5c6b7 (patch)
treee7e1b1a4820ea46641789f2bb15bd90be04d4142
parent4012d262072a3ac95878c9d061fa985301720ec2 (diff)
downloadvim-git-89015a675990bd7d70e041c5d890edb803b5c6b7.tar.gz
patch 8.2.2244: crash when making the window width negativev8.2.2244
Problem: Crash when making the window width of the not-current window negative. Solution: Make sure the window width is not negative. (closes #7568)
-rw-r--r--src/testdir/test_window_cmd.vim8
-rw-r--r--src/version.c2
-rw-r--r--src/window.c2
3 files changed, 12 insertions, 0 deletions
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index 51d072272..b0c5a417e 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -1148,6 +1148,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/version.c b/src/version.c
index 6c6d8c640..20bd86f76 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2244,
+/**/
2243,
/**/
2242,
diff --git a/src/window.c b/src/window.c
index 1cf795fd7..bea4f391a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5687,6 +5687,8 @@ win_setwidth_win(int width, win_T *wp)
if (width == 0)
width = 1;
}
+ else if (width < 0)
+ width = 0;
frame_setwidth(wp->w_frame, width + wp->w_vsep_width);