Permalink
Browse files

Version 0.39

- tlib#World#Resize: set winfix{height|width}
- g:tlib#cache#dont_purge
- tlib#vim#RestoreWindow()
- tlib#ballon#...()
  • Loading branch information...
1 parent 8956e71 commit fc9b9d2fcdac32a800355538564b36637f9b850f @tomtom tomtom committed with Sep 14, 2010
View
@@ -1,10 +1,10 @@
" Object.vim -- Prototype objects?
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
-" @Website: http://members.a1.net/t.link/
+" @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: 2009-02-15.
-" @Revision: 0.1.121
+" @Last Change: 2010-09-05.
+" @Revision: 0.1.124
" :filedoc:
" Provides a prototype plus some OO-like methods.
@@ -147,9 +147,9 @@ function! s:prototype.Super(method, arglist) dict "{{{3
endf
-function! s:prototype.Methods(...) dict "{{{3
+function! tlib#Object#Methods(object, ...) "{{{3
TVarArg ['pattern', '\d\+']
- let o = items(self)
+ let o = items(a:object)
call filter(o, 'type(v:val[1]) == 2 && string(v:val[1]) =~ "^function(''\\d\\+'')"')
let acc = {}
for e in o
View
@@ -1,10 +1,10 @@
" Test.vim -- A test class
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
-" @Website: http://members.a1.net/t.link/
+" @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: 2009-02-15.
-" @Revision: 0.1.9
+" @Last Change: 2010-09-05.
+" @Revision: 0.1.10
" :enddoc:
@@ -1,10 +1,10 @@
" TestChild.vim
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
-" @Website: http://members.a1.net/t.link/
+" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-05-18.
-" @Last Change: 2009-02-15.
-" @Revision: 0.1.13
+" @Last Change: 2010-09-05.
+" @Revision: 0.1.14
" :enddoc:
View
@@ -1,10 +1,10 @@
" World.vim -- The World prototype for tlib#input#List()
" @Author: Tom Link (micathom AT gmail com?subject=[vim])
-" @Website: http://members.a1.net/t.link/
+" @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: 2010-03-28.
-" @Revision: 0.1.834
+" @Last Change: 2010-09-05.
+" @Revision: 0.1.871
" :filedoc:
" A prototype used by |tlib#input#List|.
@@ -18,13 +18,15 @@ let s:prototype = tlib#Object#New({
\ 'base': [],
\ 'bufnr': -1,
\ 'display_format': '',
+ \ 'fileencoding': &fileencoding,
\ 'fmt_display': {},
\ 'fmt_filter': {},
\ 'filetype': '',
\ 'filter': [['']],
\ 'filter_format': '',
\ 'filter_options': '',
\ 'follow_cursor': '',
+ \ 'has_menu': 0,
\ 'index_table': [],
\ 'initial_filter': [['']],
\ 'initial_index': 1,
@@ -57,6 +59,9 @@ let s:prototype = tlib#Object#New({
\ 'timeout_resolution': 2,
\ 'type': '',
\ 'win_wnr': -1,
+ \ 'win_height': -1,
+ \ 'win_width': -1,
+ \ 'win_pct': 25,
\ })
" \ 'handlers': [],
" \ 'filter_options': '\c',
@@ -316,6 +321,14 @@ function! s:prototype.SetBaseItem(idx, item) dict "{{{3
endf
+" :nodoc:
+function! s:prototype.GetLineIdx(lnum) dict "{{{3
+ let line = getline(a:lnum)
+ let prefidx = substitute(matchstr(line, '^\d\+\ze[*:]'), '^0\+', '', '')
+ return prefidx
+endf
+
+
" :nodoc:
function! s:prototype.SetPrefIdx() dict "{{{3
" let pref = sort(range(1, self.llen), 'self.SortPrefs')
@@ -698,20 +711,40 @@ function! s:prototype.Resize(hsize, vsize) dict "{{{3
if self.scratch_vertical
if a:vsize
let world_resize = 'vert resize '. a:vsize
+ " let w:winresize = {'v': a:vsize}
+ setlocal winfixwidth
endif
else
if a:hsize
let world_resize = 'resize '. a:hsize
+ " let w:winresize = {'h': a:hsize}
+ setlocal winfixheight
endif
endif
if !empty(world_resize)
" TLogVAR world_resize
exec world_resize
- redraw!
+ " redraw!
endif
endf
+" :nodoc:
+function! s:prototype.GetResize(size) dict "{{{3
+ let resize0 = get(self, 'resize', 0)
+ let resize = empty(resize0) ? 0 : eval(resize0)
+ " TLogVAR resize0, resize
+ let resize = resize == 0 ? a:size : min([a:size, resize])
+ " let min = self.scratch_vertical ? &cols : &lines
+ let min1 = (self.scratch_vertical ? self.win_width : self.win_height) * g:tlib_inputlist_pct
+ let min2 = (self.scratch_vertical ? &columns : &lines) * self.win_pct
+ let min = max([min1, min2])
+ let resize = min([resize, (min / 100)])
+ " TLogVAR resize, a:size, min, min1, min2
+ return resize
+endf
+
+
" function! s:prototype.DisplayList(query, ?list)
" :nodoc:
function! s:prototype.DisplayList(query, ...) dict "{{{3
@@ -734,13 +767,7 @@ function! s:prototype.DisplayList(query, ...) dict "{{{3
let x = self.index_width + 1
" TLogVAR ll
if self.state =~ '\<display\>'
- let resize0 = get(self, 'resize', 0)
- let resize = empty(resize0) ? 0 : eval(resize0)
- " TLogVAR resize0, resize
- let resize = resize == 0 ? ll : min([ll, resize])
- let resize = min([resize, (&lines * g:tlib_inputlist_pct / 100)])
- " TLogVAR resize, ll, &lines
- call self.Resize(resize, eval(get(self, 'resize_vertical', 0)))
+ call self.Resize(self.GetResize(ll), eval(get(self, 'resize_vertical', 0)))
call tlib#normal#WithRegister('gg"tdG', 't')
let w = winwidth(0) - &fdc
" let w = winwidth(0) - &fdc - 1
@@ -896,6 +923,9 @@ function! s:prototype.SetOrigin(...) dict "{{{3
" TLogDBG winnr()
" TLogDBG winnr('$')
let self.win_wnr = winnr()
+ let self.win_height = winheight(self.win_wnr)
+ let self.win_width = winwidth(self.win_wnr)
+ " TLogVAR self.win_wnr, self.win_height, self.win_width
let self.bufnr = bufnr('%')
let self.cursor = getpos('.')
if winview
View
@@ -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: 2010-03-27.
-" @Revision: 0.1.178
+" @Last Change: 2010-09-05.
+" @Revision: 0.1.180
" :filedoc:
@@ -162,7 +162,7 @@ function! tlib#agent#Suspend(world, selected) "{{{3
let b:tlib_suspend = {
\ '<m-z>': 0, '<c-z>': 0, '<space>': 0,
\ '<cr>': 1,
- \ '<LeftMouse>': 1, '<c-LeftMouse>': 0, '<MiddleMouse>': 0,
+ \ '<LeftMouse>': 1, '<MiddleMouse>': 0, '<RightMouse>': 0, '<c-LeftMouse>': 0,
\ '<': 2}
for [m, pick] in items(b:tlib_suspend)
exec 'noremap <buffer> '. m .' :call tlib#input#Resume("world", '. pick .')<cr>'
View
@@ -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: 2010-03-29.
-" @Revision: 0.0.315
+" @Last Change: 2010-04-28.
+" @Revision: 0.0.318
let s:bmru = []
@@ -178,6 +178,7 @@ function! s:UndoHighlightLine() "{{{3
3match none
autocmd! TLib CursorMoved,CursorMovedI <buffer>
autocmd! TLib CursorHold,CursorHoldI <buffer>
+ autocmd! TLib InsertEnter,InsertChange,InsertLeave <buffer>
autocmd! TLib BufLeave,BufWinLeave,WinLeave,BufHidden <buffer>
endf
@@ -189,7 +190,8 @@ function! tlib#buffer#HighlightLine(...) "{{{3
call tlib#autocmdgroup#Init()
exec 'autocmd TLib CursorMoved,CursorMovedI <buffer> if line(".") != '. line .' | call s:UndoHighlightLine() | endif'
autocmd TLib CursorHold,CursorHoldI <buffer> call s:UndoHighlightLine()
- autocmd TLib BufLeave,BufWinLeave,WinLeave,BufHidden <buffer> call s:UndoHighlightLine()
+ autocmd TLib InsertEnter <buffer> call s:UndoHighlightLine()
+ " autocmd TLib BufLeave,BufWinLeave,WinLeave,BufHidden <buffer> call s:UndoHighlightLine()
endf
Oops, something went wrong.

0 comments on commit fc9b9d2

Please sign in to comment.