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:
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
|
||||
win_setminheight(void)
|
||||
{
|
||||
int room;
|
||||
int needed;
|
||||
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)
|
||||
{
|
||||
/* TODO: handle vertical splits */
|
||||
room = -p_wh;
|
||||
FOR_ALL_WINDOWS(wp)
|
||||
room += VISIBLE_HEIGHT(wp) - p_wmh;
|
||||
if (room >= 0)
|
||||
room = Rows - p_ch;
|
||||
needed = frame_minheight(topframe, NULL);
|
||||
if (room >= needed)
|
||||
break;
|
||||
--p_wmh;
|
||||
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)
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user