diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-09-03 04:49:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-03 04:49:30 -0700 |
commit | 03be64ce2ac1bd941996024a5bd0e3f9fa974445 (patch) | |
tree | 04dd2584d0eecdf8ffa9e675a8a5c7f24c6fc89a /src/nvim/window.c | |
parent | dcc8fcf0b9d819357d5ec9beb36cf698e600e809 (diff) | |
parent | 7199f0b3b3e31c1c3b96d17d6f1f959d1db5ce76 (diff) | |
download | rneovim-03be64ce2ac1bd941996024a5bd0e3f9fa974445.tar.gz rneovim-03be64ce2ac1bd941996024a5bd0e3f9fa974445.tar.bz2 rneovim-03be64ce2ac1bd941996024a5bd0e3f9fa974445.zip |
Merge #10921 from janlazo/vim-8.0.1768
vim-patch:8.0.{1768,1806},8.1.{46,1063}
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 0e8cfcedf5..6861e19ca7 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -5229,27 +5229,42 @@ static void frame_setwidth(frame_T *curfrp, int width) } } -/* - * Check 'winminheight' for a valid value. - */ +// Check 'winminheight' for a valid value and reduce it if needed. void win_setminheight(void) { - int room; - int first = TRUE; + bool first = true; - /* loop until there is a 'winminheight' that is possible */ + // loop until there is a 'winminheight' that is possible while (p_wmh > 0) { - /* TODO: handle vertical splits */ - room = -p_wh; - FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { - room += wp->w_height - p_wmh; + const int room = Rows - p_ch; + const int needed = frame_minheight(topframe, NULL); + if (room >= needed) { + break; + } + p_wmh--; + if (first) { + EMSG(_(e_noroom)); + first = false; } - if (room >= 0) + } +} + +// Check 'winminwidth' for a valid value and reduce it if needed. +void win_setminwidth(void) +{ + bool first = true; + + // loop until there is a 'winminheight' that is possible + while (p_wmw > 0) { + const int room = Columns; + const int needed = frame_minwidth(topframe, NULL); + if (room >= needed) { break; - --p_wmh; + } + p_wmw--; if (first) { EMSG(_(e_noroom)); - first = FALSE; + first = false; } } } |