zoomwintab.vim icon indicating copy to clipboard operation
zoomwintab.vim copied to clipboard

only one window

Open tonywoode opened this issue 5 years ago • 8 comments

About 15% of the time, when I have zoomed into a window, the underlying layout disappears, so when I use my leader combo to return to the previous layout, vim informs me there is only one window. This plugin otherwise does everything really well (and I've tried some alternatives that don't)

I can't isolate the conditions under which this happens, I'm sure its nothing obvious like when I open/close/restore my terminal, since this can happen at any point. (Although I do use https://github.com/tpope/vim-obsession and https://github.com/dhruvasagar/vim-prosession and lately i've wondered if their session-catpure refreshes might be to blame)

It does seem like it only happens if I have more than one tab open, but that's probably symptomatic of how the plugin works, rather than of the problem. But certainly all other tabs don't disappear when this happens, just the tab I zoomed 'into'...

Can anyone suggest how to troubleshoot or ease?

tonywoode avatar Mar 19 '20 13:03 tonywoode

This happens to me too at one point or another but rarely, not sure why it's happening, it would be nice to pinpoint the cause or at least find a way to reproduce this issue so I could debug it.

btw, do you use default Ctrl-W o keybinding to zoom in, I have a hunch that it happens because sometimes I accidently hit Ctrl-W Ctrl-O instead of Ctrl-W o

troydm avatar Mar 19 '20 14:03 troydm

yup, that makes a lot of sense, yup when I CTRL_W CTRL_O that's exactly what happens! Thank you for the quick response and immediate easing of the issue (i'll let you know should I be able to disprove this)

However, why is this the case since all your commands should map both CTRL_W O and CTRL_W CTRL_O to the same action? https://github.com/troydm/zoomwintab.vim/blob/master/plugin/zoomwintab.vim#L88 https://github.com/troydm/zoomwintab.vim/blob/master/plugin/zoomwintab.vim#L91 (and yes i get the same behaviour in terminal or macvim)

tonywoode avatar Mar 20 '20 15:03 tonywoode

@tonywoode not sure actually, sorry had a really busy week and I haven't had time to investigate it yet, probably it somehow interprets Ctrl-O separately ignoring the mapping or something, I'll investigate it when I'll have time

troydm avatar Mar 22 '20 03:03 troydm

@tonywoode I've managed to find a bug it was <C-w_o> mapping related which made other buffers to close so I've added additional default mapping which will remap this key mapping to zooming, just update your plugin to latest commit, also I'm closing this bug so if you think that this doesn't fixes your problem please feel free to reopen it

troydm avatar Apr 07 '20 16:04 troydm

thanks everso: sure i've updated glad you found the issue!

tonywoode avatar Apr 08 '20 11:04 tonywoode

Sorry would like to reopen this (but I don't have the option here: you'd have to do it), I still seem to manage to reproduce the bug with the same frequency as previously (despite being on 3b33368ed2ff)

Something I notice is that I always seem to trigger it at the very worst moment: namely when i'm demonstrating something to others. I would guess that other people watching me makes me sloppier and more prone to error on the keyboard due to reduced ability to concentrate (again suggesting that your Crtl-O observation would be a likely cause, however as your related recent commits suggest: I cannot now trigger :only with any combo of ctrl+O, so I can't work out how i'm continuing to cause it. I was wondering if its possible to trigger an :only keyboard combo by including the original combo as part of a larger command, but Ctrl_w takes no count...I am a NerdTree user, perhaps you are too?

tonywoode avatar Sep 20 '21 16:09 tonywoode

I think I was on the right track there: provide a window number to 'o' and :only is triggered: i.e. hit: Ctrl+w, 2 , o and the second window becomes the only window. I don't think that's directly it, as I wouldn't often reach up to a number in the middle of a command, and I always end up with the window I inteded to maximise as the only window - so I wonder if there is a more-likely second key to have pressed than a window number - is there a key for 'current/cursor' window perhaps?

tonywoode avatar Sep 20 '21 16:09 tonywoode

@tonywoode you are absolutely right about C-w, 2, o combination, it reproduces this issue, I'm reopening the bug and will try to figure out how to mitigate this and which key combinations trigger this issue more often, so far I'm thinking of introducing special option which will rebind :only combinations to zoomwintab if enabled, for now I've added additional mappings in last commit that seem like the fix the issue, please try it out and tell me if it helps

troydm avatar Oct 10 '21 09:10 troydm