Mercurial > vim
comparison src/window.c @ 18467:99fc29219b3e v8.1.2227
patch 8.1.2227: layout wrong if 'lines' changes while cmdline window is open
Commit: https://github.com/vim/vim/commit/1c329c04be2e95a3589a53f2978926e91b450cca
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 27 20:37:35 2019 +0100
patch 8.1.2227: layout wrong if 'lines' changes while cmdline window is open
Problem: Layout wrong if 'lines' changes while cmdline window is open.
Solution: Do not restore the window layout if 'lines' changed.
(closes #5130)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 27 Oct 2019 20:45:03 +0100 |
parents | 9f51d0cef8da |
children | 41484f342f80 |
comparison
equal
deleted
inserted
replaced
18466:0a0e391c6d59 | 18467:99fc29219b3e |
---|---|
5175 | 5175 |
5176 { | 5176 { |
5177 win_T *wp; | 5177 win_T *wp; |
5178 | 5178 |
5179 ga_init2(gap, (int)sizeof(int), 1); | 5179 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 | |
5181 FOR_ALL_WINDOWS(wp) | 5185 FOR_ALL_WINDOWS(wp) |
5182 { | 5186 { |
5183 ((int *)gap->ga_data)[gap->ga_len++] = | 5187 ((int *)gap->ga_data)[gap->ga_len++] = |
5184 wp->w_width + wp->w_vsep_width; | 5188 wp->w_width + wp->w_vsep_width; |
5185 ((int *)gap->ga_data)[gap->ga_len++] = wp->w_height; | 5189 ((int *)gap->ga_data)[gap->ga_len++] = wp->w_height; |
5186 } | 5190 } |
5187 } | 5191 } |
5188 | 5192 } |
5189 /* | 5193 |
5190 * Restore window sizes, but only if the number of windows is still the same. | 5194 /* |
5195 * Restore window sizes, but only if the number of windows is still the same | |
5196 * and 'lines' didn't change. | |
5191 * Does not free the growarray. | 5197 * Does not free the growarray. |
5192 */ | 5198 */ |
5193 void | 5199 void |
5194 win_size_restore(garray_T *gap) | 5200 win_size_restore(garray_T *gap) |
5195 { | 5201 { |
5196 win_T *wp; | 5202 win_T *wp; |
5197 int i, j; | 5203 int i, j; |
5198 | 5204 |
5199 if (win_count() * 2 == gap->ga_len) | 5205 if (win_count() * 2 + 1 == gap->ga_len |
5206 && ((int *)gap->ga_data)[0] == Rows) | |
5200 { | 5207 { |
5201 /* The order matters, because frames contain other frames, but it's | 5208 /* The order matters, because frames contain other frames, but it's |
5202 * difficult to get right. The easy way out is to do it twice. */ | 5209 * difficult to get right. The easy way out is to do it twice. */ |
5203 for (j = 0; j < 2; ++j) | 5210 for (j = 0; j < 2; ++j) |
5204 { | 5211 { |
5205 i = 0; | 5212 i = 1; |
5206 FOR_ALL_WINDOWS(wp) | 5213 FOR_ALL_WINDOWS(wp) |
5207 { | 5214 { |
5208 frame_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]); | 5215 frame_setwidth(wp->w_frame, ((int *)gap->ga_data)[i++]); |
5209 win_setheight_win(((int *)gap->ga_data)[i++], wp); | 5216 win_setheight_win(((int *)gap->ga_data)[i++], wp); |
5210 } | 5217 } |
6372 total += 1; /* count the room for the command line */ | 6379 total += 1; /* count the room for the command line */ |
6373 return total; | 6380 return total; |
6374 } | 6381 } |
6375 | 6382 |
6376 /* | 6383 /* |
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 |
6378 * counting a help or preview window, unless it is the current window. | 6385 * counting a help or preview window, unless it is the current window. |
6379 * Does not count unlisted windows. | 6386 * Does not count unlisted windows. |
6380 */ | 6387 */ |
6381 int | 6388 int |
6382 only_one_window(void) | 6389 only_one_window(void) |