forked from aniani/vim
patch 8.1.0046: loading a session file fails if 'winheight' is big
Problem: Loading a session file fails if 'winheight' is a big number. Solution: Set 'minwinheight' to zero at first. Don't give an error when setting 'minwinheight' while 'winheight' is a big number. Fix using vertical splits. Fix setting 'minwinwidth'. (closes #2970)
This commit is contained in:
10
src/option.c
10
src/option.c
@@ -8796,6 +8796,7 @@ set_num_option(
|
|||||||
*/
|
*/
|
||||||
if (pp == &p_wh || pp == &p_hh)
|
if (pp == &p_wh || pp == &p_hh)
|
||||||
{
|
{
|
||||||
|
// 'winheight' and 'helpheight'
|
||||||
if (p_wh < 1)
|
if (p_wh < 1)
|
||||||
{
|
{
|
||||||
errmsg = e_positive;
|
errmsg = e_positive;
|
||||||
@@ -8821,10 +8822,9 @@ set_num_option(
|
|||||||
win_setheight((int)p_hh);
|
win_setheight((int)p_hh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 'winminheight' */
|
|
||||||
else if (pp == &p_wmh)
|
else if (pp == &p_wmh)
|
||||||
{
|
{
|
||||||
|
// 'winminheight'
|
||||||
if (p_wmh < 0)
|
if (p_wmh < 0)
|
||||||
{
|
{
|
||||||
errmsg = e_positive;
|
errmsg = e_positive;
|
||||||
@@ -8839,6 +8839,7 @@ set_num_option(
|
|||||||
}
|
}
|
||||||
else if (pp == &p_wiw)
|
else if (pp == &p_wiw)
|
||||||
{
|
{
|
||||||
|
// 'winwidth'
|
||||||
if (p_wiw < 1)
|
if (p_wiw < 1)
|
||||||
{
|
{
|
||||||
errmsg = e_positive;
|
errmsg = e_positive;
|
||||||
@@ -8854,10 +8855,9 @@ set_num_option(
|
|||||||
if (!ONE_WINDOW && curwin->w_width < p_wiw)
|
if (!ONE_WINDOW && curwin->w_width < p_wiw)
|
||||||
win_setwidth((int)p_wiw);
|
win_setwidth((int)p_wiw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 'winminwidth' */
|
|
||||||
else if (pp == &p_wmw)
|
else if (pp == &p_wmw)
|
||||||
{
|
{
|
||||||
|
// 'winminwidth'
|
||||||
if (p_wmw < 0)
|
if (p_wmw < 0)
|
||||||
{
|
{
|
||||||
errmsg = e_positive;
|
errmsg = e_positive;
|
||||||
@@ -8868,7 +8868,7 @@ set_num_option(
|
|||||||
errmsg = e_winwidth;
|
errmsg = e_winwidth;
|
||||||
p_wmw = p_wiw;
|
p_wmw = p_wiw;
|
||||||
}
|
}
|
||||||
win_setminheight();
|
win_setminwidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (re)set last window status line */
|
/* (re)set last window status line */
|
||||||
|
@@ -54,6 +54,7 @@ void win_setheight_win(int height, win_T *win);
|
|||||||
void win_setwidth(int width);
|
void win_setwidth(int width);
|
||||||
void win_setwidth_win(int width, win_T *wp);
|
void win_setwidth_win(int width, win_T *wp);
|
||||||
void win_setminheight(void);
|
void win_setminheight(void);
|
||||||
|
void win_setminwidth(void);
|
||||||
void win_drag_status_line(win_T *dragwin, int offset);
|
void win_drag_status_line(win_T *dragwin, int offset);
|
||||||
void win_drag_vsep_line(win_T *dragwin, int offset);
|
void win_drag_vsep_line(win_T *dragwin, int offset);
|
||||||
void set_fraction(win_T *wp);
|
void set_fraction(win_T *wp);
|
||||||
|
@@ -106,13 +106,22 @@ endfunc
|
|||||||
|
|
||||||
func Test_mksession_winheight()
|
func Test_mksession_winheight()
|
||||||
new
|
new
|
||||||
set winheight=10 winminheight=2
|
set winheight=10
|
||||||
|
set winminheight=2
|
||||||
mksession! Xtest_mks.out
|
mksession! Xtest_mks.out
|
||||||
source Xtest_mks.out
|
source Xtest_mks.out
|
||||||
|
|
||||||
call delete('Xtest_mks.out')
|
call delete('Xtest_mks.out')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_mksession_large_winheight()
|
||||||
|
set winheight=999
|
||||||
|
mksession! Xtest_mks_winheight.out
|
||||||
|
set winheight&
|
||||||
|
source Xtest_mks_winheight.out
|
||||||
|
call delete('Xtest_mks_winheight.out')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_mksession_arglist()
|
func Test_mksession_arglist()
|
||||||
argdel *
|
argdel *
|
||||||
next file1 file2 file3 file4
|
next file1 file2 file3 file4
|
||||||
|
@@ -761,6 +761,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
46,
|
||||||
/**/
|
/**/
|
||||||
45,
|
45,
|
||||||
/**/
|
/**/
|
||||||
|
40
src/window.c
40
src/window.c
@@ -5430,23 +5430,21 @@ frame_setwidth(frame_T *curfrp, int width)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check 'winminheight' for a valid value.
|
* Check 'winminheight' for a valid value and reduce it if needed.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
win_setminheight(void)
|
win_setminheight(void)
|
||||||
{
|
{
|
||||||
int room;
|
int room;
|
||||||
|
int needed;
|
||||||
int first = TRUE;
|
int first = TRUE;
|
||||||
win_T *wp;
|
|
||||||
|
|
||||||
/* loop until there is a 'winminheight' that is possible */
|
// loop until there is a 'winminheight' that is possible
|
||||||
while (p_wmh > 0)
|
while (p_wmh > 0)
|
||||||
{
|
{
|
||||||
/* TODO: handle vertical splits */
|
room = Rows - p_ch;
|
||||||
room = -p_wh;
|
needed = frame_minheight(topframe, NULL);
|
||||||
FOR_ALL_WINDOWS(wp)
|
if (room >= needed)
|
||||||
room += VISIBLE_HEIGHT(wp) - p_wmh;
|
|
||||||
if (room >= 0)
|
|
||||||
break;
|
break;
|
||||||
--p_wmh;
|
--p_wmh;
|
||||||
if (first)
|
if (first)
|
||||||
@@ -5457,6 +5455,32 @@ win_setminheight(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check 'winminwidth' for a valid value and reduce it if needed.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
win_setminwidth(void)
|
||||||
|
{
|
||||||
|
int room;
|
||||||
|
int needed;
|
||||||
|
int first = TRUE;
|
||||||
|
|
||||||
|
// loop until there is a 'winminheight' that is possible
|
||||||
|
while (p_wmw > 0)
|
||||||
|
{
|
||||||
|
room = Columns;
|
||||||
|
needed = frame_minwidth(topframe, NULL);
|
||||||
|
if (room >= needed)
|
||||||
|
break;
|
||||||
|
--p_wmw;
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
EMSG(_(e_noroom));
|
||||||
|
first = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(FEAT_MOUSE) || defined(PROTO)
|
#if defined(FEAT_MOUSE) || defined(PROTO)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user