mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 22:08:18 +00:00
vim-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 vim/vim#5130)
1c329c04be
This commit is contained in:
@@ -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++];
|
||||
|
Reference in New Issue
Block a user