From f5320f645b325546f13289a708ba2efce3204c87 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 16 Sep 2014 19:23:11 +0900 Subject: vim-patch:7.4.368 Problem: Restoring the window sizes after closing the command line window doesn't work properly if there are nested splits. Solution: Restore the sizes twice. (Hirohito Higashi) https://code.google.com/p/vim/source/detail?r=v7-4-368 --- src/nvim/window.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/nvim/window.c') diff --git a/src/nvim/window.c b/src/nvim/window.c index b9714ce690..dccf3e2efc 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -3800,10 +3800,15 @@ void win_size_save(garray_T *gap) void win_size_restore(garray_T *gap) { if (win_count() * 2 == gap->ga_len) { - int i = 0; - FOR_ALL_WINDOWS(wp) { - frame_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]); - win_setheight_win(((int *)gap->ga_data)[i++], wp); + /* The order matters, because frames contain other frames, but it's + * difficult to get right. The easy way out is to do it twice. */ + for (int j = 0; j < 2; ++j) + { + int i = 0; + FOR_ALL_WINDOWS(wp) { + frame_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]); + win_setheight_win(((int *)gap->ga_data)[i++], wp); + } } /* recompute the window positions */ (void)win_comp_pos(); -- cgit