You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a user has a winheight set higher than a window's &lines value, when saving a session and restoring it later, a "E36: Not enough room" error is thrown, causing the rest of the session settings to fail to load.
To Reproduce (Vim v8.1.26):
Set winheight large, and save a session:
vim -N -u NONE --cmd 'set winheight=999' --cmd 'mksession! /tmp/session.vim'
Exit, and then an error is thrown when restoring the session:
vim -N -u NONE --cmd 'source /tmp/session.vim'
Expected Behavior:
A user should be able to restore a session without an error being thrown, no matter what winheight is set to.
--
Here is a simplified repro case, without needing a session:
Edit: The below is wrong - there's more to this than I initially thought, though I'm not following the code too well in src/window.c, which is what throws the error. There is still a bug, however.
The problem appears to be from line 11277 of src/ex_docmd.c, which has the following settings hardcoded when saving a session:
if (put_line(fd, "set winminheight=1 winheight=1 winminwidth=1 winwidth=1") ==FAIL)
It appears that line just temporarily sets those settings while it opens the buffers, but then restores the user's initial settings. I'm not 100% sure if this is the correct fix, but I have verified that changing the min values to 0 gets rid of the error:
As an aside, the reason I've set winheight=999 in the first place is due to how I use vertical splits. It's nice to have the split auto-expand to the full height while navigating around them, as detailed in this vim tip.
(edit: pulled my simple fix, as it doesn't actually fix the underlying issue).
The text was updated successfully, but these errors were encountered:
Indeed, the hard minimum is 'winminheight', not 'winheight', with the proviso that the current window always gets at least one line in adition to its statusline, even if 'winminheight' is zero.
Myself, I set 'winminheight' to zero and 'winheight' to 9999 as part of what I call "Rolodex Vim", where the current window expands to the maximum possible height, reducing all other windows to only a statusline above and below it, as in an office Rolodex where the current index card is open full-height while all others are reduced to tabs above and below it.
Nice! That's exactly how I've operated for years (minus the fancy toggles in your link). Clever name for it.
I only noticed and reported this problem because I finally got around to playing with mksession, but I sadly can't use them without some workaround until this bug is fix.
Problem: Loading a session file fails if 'winheight' is a big number.
Solution: Set 'minwinheight' to zero at first. Don't give an error when
setting 'minwinheight' while 'winheight' is a big number.
Fix using vertical splits. Fix setting 'minwinwidth'.
(closesvim/vim#2970)
vim/vim@1c3c104
If a user has a
winheight
set higher than a window's&lines
value, when saving a session and restoring it later, a "E36: Not enough room" error is thrown, causing the rest of the session settings to fail to load.To Reproduce (Vim v8.1.26):
Set
winheight
large, and save a session:Exit, and then an error is thrown when restoring the session:
vim -N -u NONE --cmd 'source /tmp/session.vim'
Expected Behavior:
A user should be able to restore a session without an error being thrown, no matter what
winheight
is set to.--
Here is a simplified repro case, without needing a session:
Edit: The below is wrong - there's more to this than I initially thought, though I'm not following the code too well in
src/window.c
, which is what throws the error. There is still a bug, however.The problem appears to be from line 11277 of
src/ex_docmd.c
, which has the following settings hardcoded when saving a session:It appears that line just temporarily sets those settings while it opens the buffers, but then restores the user's initial settings. I'm not 100% sure if this is the correct fix, but I have verified that changing the
min
values to 0 gets rid of the error:As an aside, the reason I've set winheight=999 in the first place is due to how I use vertical splits. It's nice to have the split auto-expand to the full height while navigating around them, as detailed in this vim tip.
(edit: pulled my simple fix, as it doesn't actually fix the underlying issue).
The text was updated successfully, but these errors were encountered: