xolox / vim-shell

Improved integration between Vim and its environment (fullscreen, open URL, background command execution)
http://peterodding.com/code/vim/shell/
169 stars 13 forks source link

Restoring window size & position when toggling off fullscreen #2

Closed dionysiak closed 13 years ago

dionysiak commented 13 years ago

Thanks for all your work on the vim plugins, really enjoying the full screen in windows.

One thing I often do in other editors is jump from a small window to fullscreen to get a closer look at some code, and then toggle back to the smaller window when done.. The current default behaviour of fullscreen() leaves the window maximised after toggling full screen off. I've attached a patch that makes the function save the window size and position the same way it saves the guioptions.

I'm new to vim, so apologies if you've covered this already (or if it's even in vim proper somewhere). Don't know if this will work on anything other than gVim under windows.. I'm just hacking :)

--- shell.vim.bak   Fri Dec 17 12:58:48 2010
+++ shell.vim   Fri Dec 17 12:53:27 2010
@@ -142,6 +142,9 @@
   " and tab line. Remember which components were actually hidden and should be
   " restored when leaving full-screen later.
   if !s:fullscreen_enabled
+   let s:olines = &lines
+   let s:ocolumns = &columns
+   let s:opos = getwinposx() . ' ' . getwinposy()
     let s:go_toggled = ''
     for item in split(g:shell_fullscreen_items, '.\zs')
       if &go =~# item
@@ -184,6 +187,9 @@
       let &stal = s:stal_save
       unlet s:stal_save
     endif
+   let &lines = s:olines
+   let &columns = s:ocolumns
+   exec ':winpos ' . s:opos
   endif

   " Toggle the boolean status returned by xolox#shell#is_fullscreen().
xolox commented 13 years ago

Hi dionysiac- and thanks for your feedback. The wmctrl program that's used for full-screen on Linux automatically restores the window size and position, so I didn't notice the problem you describe until I recently wanted to use full-screen on Windows for the same purpose you mention.

I agree that the window size and position should be restored when leaving full-screen on Windows so I've committed 681404594304bfa6a0526df23d41bb1833acba6d which fixes this problem. I've also uploaded a new release to Vim Online as version 0.9.1. Closing this issue now as the problem should be fixed. Happy Vimming!