@@ -5177,17 +5177,23 @@ win_size_save(garray_T *gap)
51775177 win_T * wp ;
51785178
51795179 ga_init2 (gap , (int )sizeof (int ), 1 );
5180- if (ga_grow (gap , win_count () * 2 ) == OK )
5180+ if (ga_grow (gap , win_count () * 2 + 1 ) == OK )
5181+ {
5182+ // first entry is value of 'lines'
5183+ ((int * )gap -> ga_data )[gap -> ga_len ++ ] = Rows ;
5184+
51815185 FOR_ALL_WINDOWS (wp )
51825186 {
51835187 ((int * )gap -> ga_data )[gap -> ga_len ++ ] =
51845188 wp -> w_width + wp -> w_vsep_width ;
51855189 ((int * )gap -> ga_data )[gap -> ga_len ++ ] = wp -> w_height ;
51865190 }
5191+ }
51875192}
51885193
51895194/*
5190- * Restore window sizes, but only if the number of windows is still the same.
5195+ * Restore window sizes, but only if the number of windows is still the same
5196+ * and 'lines' didn't change.
51915197 * Does not free the growarray.
51925198 */
51935199 void
@@ -5196,13 +5202,14 @@ win_size_restore(garray_T *gap)
51965202 win_T * wp ;
51975203 int i , j ;
51985204
5199- if (win_count () * 2 == gap -> ga_len )
5205+ if (win_count () * 2 + 1 == gap -> ga_len
5206+ && ((int * )gap -> ga_data )[0 ] == Rows )
52005207 {
52015208 /* The order matters, because frames contain other frames, but it's
52025209 * difficult to get right. The easy way out is to do it twice. */
52035210 for (j = 0 ; j < 2 ; ++ j )
52045211 {
5205- i = 0 ;
5212+ i = 1 ;
52065213 FOR_ALL_WINDOWS (wp )
52075214 {
52085215 frame_setwidth (wp -> w_frame , ((int * )gap -> ga_data )[i ++ ]);
@@ -6374,7 +6381,7 @@ min_rows(void)
63746381}
63756382
63766383/*
6377- * Return TRUE if there is only one window (in the current tab page) , not
6384+ * Return TRUE if there is only one window and only one tab page, not
63786385 * counting a help or preview window, unless it is the current window.
63796386 * Does not count unlisted windows.
63806387 */
0 commit comments