aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-27 17:14:31 -0500
committerGitHub <noreply@github.com>2020-12-27 17:14:31 -0500
commita58c5509d94f01f4a4edd6b4784f8d00b70af5b3 (patch)
treeb3cadc41e6fd4c747de5635dc0fb7556ec5e6e13 /src/nvim/window.c
parentf2be59d8f80f2a1a68d5976b9cec3fa55da3700e (diff)
parentcff4cad25a1236bd869843f9578b7f276518d9b8 (diff)
downloadrneovim-a58c5509d94f01f4a4edd6b4784f8d00b70af5b3.tar.gz
rneovim-a58c5509d94f01f4a4edd6b4784f8d00b70af5b3.tar.bz2
rneovim-a58c5509d94f01f4a4edd6b4784f8d00b70af5b3.zip
Merge pull request #13607 from janlazo/vim-8.2.2221
vim-patch:8.1.2227,8.2.{315,928,1007,1052,1121,1580,2221,2229,2231,2232}
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 6ecfd9ab64..2dcce2d8cb 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5013,7 +5013,10 @@ void win_size_save(garray_T *gap)
{
ga_init(gap, (int)sizeof(int), 1);
- ga_grow(gap, win_count() * 2);
+ ga_grow(gap, win_count() * 2 + 1);
+ // first entry is value of 'lines'
+ ((int *)gap->ga_data)[gap->ga_len++] = Rows;
+
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
((int *)gap->ga_data)[gap->ga_len++] =
wp->w_width + wp->w_vsep_width;
@@ -5021,18 +5024,18 @@ void win_size_save(garray_T *gap)
}
}
-/*
- * Restore window sizes, but only if the number of windows is still the same.
- * Does not free the growarray.
- */
+// Restore window sizes, but only if the number of windows is still the same
+// and 'lines' didn't change.
+// Does not free the growarray.
void win_size_restore(garray_T *gap)
+ FUNC_ATTR_NONNULL_ALL
{
- if (win_count() * 2 == gap->ga_len) {
- /* 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;
+ if (win_count() * 2 + 1 == gap->ga_len
+ && ((int *)gap->ga_data)[0] == Rows) {
+ // 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 = 1;
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
int width = ((int *)gap->ga_data)[i++];
int height = ((int *)gap->ga_data)[i++];