Skip to content

Commit

Permalink
win32: Fix moving window when using :vertical for tlib#inpu#List()
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtom committed Feb 22, 2013
1 parent 45d7fa3 commit 9649dfb
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
11 changes: 8 additions & 3 deletions autoload/tlib/World.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-05-01.
" @Last Change: 2013-02-19.
" @Revision: 0.1.1231
" @Last Change: 2013-02-22.
" @Revision: 0.1.1250

" :filedoc:
" A prototype used by |tlib#input#List|.
Expand Down Expand Up @@ -927,12 +927,14 @@ endf
function! s:prototype.Resize(hsize, vsize) dict "{{{3
" TLogVAR self.scratch_vertical, a:hsize, a:vsize
let world_resize = ''
let winpos = ''
let scratch_split = get(self, 'scratch_split', 1)
" TLogVAR scratch_split
if scratch_split > 0
if self.scratch_vertical
if a:vsize
let world_resize = 'vert resize '. a:vsize
let winpos = tlib#fixes#Winpos()
" let w:winresize = {'v': a:vsize}
setlocal winfixwidth
endif
Expand All @@ -945,8 +947,11 @@ function! s:prototype.Resize(hsize, vsize) dict "{{{3
endif
endif
if !empty(world_resize)
" TLogVAR world_resize
" TLogVAR world_resize, winpos
exec world_resize
if !empty(winpos)
exec winpos
endif
" redraw!
endif
endf
Expand Down
8 changes: 6 additions & 2 deletions autoload/tlib/agent.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-06-24.
" @Last Change: 2012-10-03.
" @Revision: 0.1.208
" @Last Change: 2013-02-22.
" @Revision: 0.1.209


" :filedoc:
Expand Down Expand Up @@ -401,7 +401,11 @@ function! tlib#agent#EditFileInVSplit(world, selected) "{{{3
call a:world.CloseScratch()
" call tlib#file#With('edit', 'buffer', a:selected[0:0], a:world)
" call tlib#file#With('vertical split', 'vertical sbuffer', a:selected[1:-1], a:world)
let winpos = tlib#fixes#Winpos()
call tlib#file#With('vertical split', 'vertical sbuffer', a:selected, a:world)
if !empty(winpos)
exec winpos
endif
return tlib#agent#Exit(a:world, a:selected)
endf

Expand Down
14 changes: 14 additions & 0 deletions autoload/tlib/fixes.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Last Change: 2013-02-22.
" @Revision: 3


function! tlib#fixes#Winpos() "{{{3
if has('gui_win32')
return 'winpos '. getwinposx() .' '. getwinposy()
else
return ''
endif
endf

4 changes: 2 additions & 2 deletions autoload/tlib/input.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-06-30.
" @Last Change: 2012-12-18.
" @Revision: 0.0.981
" @Last Change: 2013-02-22.
" @Revision: 0.0.995


" :filedoc:
Expand Down
15 changes: 12 additions & 3 deletions autoload/tlib/scratch.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-07-18.
" @Last Change: 2012-02-08.
" @Revision: 0.0.167
" @Last Change: 2013-02-22.
" @Revision: 0.0.175

if &cp || exists("loaded_tlib_scratch_autoload")
finish
Expand Down Expand Up @@ -34,11 +34,13 @@ function! tlib#scratch#UseScratch(...) "{{{3
" let ft = &ft
let ft = '*'
else
let winpos = ''
let bn = bufnr(id)
let wpos = get(keyargs, 'scratch_pos', g:tlib_scratch_pos)
" TLogVAR keyargs.scratch_vertical
if get(keyargs, 'scratch_vertical')
let wpos .= ' vertical'
let winpos = tlib#fixes#Winpos()
endif
" TLogVAR wpos
let scratch_split = get(keyargs, 'scratch_split', 1)
Expand Down Expand Up @@ -73,7 +75,10 @@ function! tlib#scratch#UseScratch(...) "{{{3
" silent exec 'split '. id
endif
let ft = get(keyargs, 'scratch_filetype', '')
" TLogVAR ft
" TLogVAR ft, winpos
if !empty(winpos)
exec winpos
endif
endif
setlocal buftype=nofile
setlocal bufhidden=hide
Expand Down Expand Up @@ -106,7 +111,11 @@ function! tlib#scratch#CloseScratch(keyargs, ...) "{{{3
if wn != -1
" TLogDBG winnr()
let wb = tlib#win#Set(wn)
let winpos = tlib#fixes#Winpos()
wincmd c
if get(a:keyargs, 'scratch_vertical') && !empty(winpos)
exec winpos
endif
" exec wb
" redraw
" TLogVAR winnr()
Expand Down

0 comments on commit 9649dfb

Please sign in to comment.