Skip to content

Commit

Permalink
Version 0.36
Browse files Browse the repository at this point in the history
- Display a message when the filter is for whatever reason invalid
- Removed tlib#paragraph#Delete()
- New: tlib#paragraph#Define(), tlib#textobjects#StandardParagraph()
  • Loading branch information
tomtom authored and vim-scripts committed Oct 18, 2010
1 parent afbf493 commit eb07ace
Show file tree
Hide file tree
Showing 14 changed files with 459 additions and 314 deletions.
9 changes: 3 additions & 6 deletions autoload/tlib.vim
Expand Up @@ -3,13 +3,10 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-07-17.
" @Last Change: 2009-02-15.
" @Revision: 0.0.5
" @Last Change: 2010-01-03.
" @Revision: 0.0.7

if &cp || exists("loaded_tlib_autoload")
finish
endif
let loaded_tlib_autoload = 1
" call tlog#Log('Load: '. expand('<sfile>')) " vimtlib-sfile

" Dummy file for backwards compatibility.

71 changes: 52 additions & 19 deletions autoload/tlib/World.vim
Expand Up @@ -3,27 +3,23 @@
" @Website: http://members.a1.net/t.link/
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-05-01.
" @Last Change: 2009-10-25.
" @Revision: 0.1.740
" @Last Change: 2010-02-06.
" @Revision: 0.1.812

" :filedoc:
" A prototype used by |tlib#input#List|.
" Inherits from |tlib#Object#New|.


if &cp || exists("loaded_tlib_world_autoload")
finish
endif
let loaded_tlib_world_autoload = 1


let s:prototype = tlib#Object#New({
\ '_class': 'World',
\ 'name': 'world',
\ 'allow_suspend': 1,
\ 'base': [],
\ 'bufnr': -1,
\ 'display_format': '',
\ 'fmt_display': {},
\ 'fmt_filter': {},
\ 'filetype': '',
\ 'filter': [['']],
\ 'filter_format': '',
Expand Down Expand Up @@ -155,17 +151,25 @@ endf

" :nodoc:
function! s:prototype.GetSelectedItems(current) dict "{{{3
" TLogVAR a:current
if stridx(self.type, 'i') != -1
let rv = copy(self.sel_idx)
else
let rv = map(copy(self.sel_idx), 'self.GetBaseItem(v:val)')
endif
if a:current != ''
let ci = index(rv, a:current)
if ci != -1
call remove(rv, ci)
if !empty(a:current)
" TLogVAR a:current, rv, type(a:current)
if tlib#type#IsNumber(a:current) || tlib#type#IsString(a:current)
call s:InsertSelectedItems(rv, a:current)
elseif tlib#type#IsList(a:current)
for item in a:current
call s:InsertSelectedItems(rv, item)
endfor
elseif tlib#type#IsDictionary(a:current)
for [inum, item] in items(a:current)
call s:InsertSelectedItems(rv, item)
endfor
endif
call insert(rv, a:current)
endif
" TAssert empty(rv) || rv[0] == a:current
if stridx(self.type, 'i') != -1
Expand All @@ -179,6 +183,15 @@ function! s:prototype.GetSelectedItems(current) dict "{{{3
endf


function! s:InsertSelectedItems(rv, current) "{{{3
let ci = index(a:rv, a:current)
if ci != -1
call remove(a:rv, ci)
endif
call insert(a:rv, a:current)
endf


" :nodoc:
function! s:prototype.SelectItem(mode, index) dict "{{{3
let bi = self.GetBaseIdx(a:index)
Expand Down Expand Up @@ -235,9 +248,21 @@ endf


" :nodoc:
function! s:prototype.FormatName(format, value) dict "{{{3
let world = self
return eval(call(function("printf"), self.FormatArgs(a:format, a:value)))
function! s:prototype.FormatName(cache, format, value) dict "{{{3
" TLogVAR a:format, a:value
" TLogDBG has_key(self.fmt_display, a:value)
if has_key(a:cache, a:value)
" TLogDBG "cached"
return a:cache[a:value]
else
let world = self
let ftpl = self.FormatArgs(a:format, a:value)
let fn = call(function("printf"), ftpl)
let fmt = eval(fn)
" TLogVAR ftpl, fn, fmt
let a:cache[a:value] = fmt
return fmt
endif
endf


Expand Down Expand Up @@ -429,7 +454,7 @@ endf
function! s:prototype.MatchBaseIdx(idx) dict "{{{3
let text = self.GetBaseItem(a:idx)
if !empty(self.filter_format)
let text = self.FormatName(self.filter_format, text)
let text = self.FormatName(self.fmt_filter, self.filter_format, text)
endif
" TLogVAR text
" return self.Match(text)
Expand All @@ -438,10 +463,16 @@ endf


" :nodoc:
function! s:prototype.BuildTable() dict "{{{3
function! s:prototype.BuildTableList() dict "{{{3
call self.SetFilter()
" TLogVAR self.filter_neg, self.filter_pos
let self.table = filter(range(1, len(self.base)), 'self.MatchBaseIdx(v:val)')
if empty(self.filter_pos) && empty(self.filter_neg)
let self.table = range(1, len(self.base))
let self.list = copy(self.base)
else
let self.table = filter(range(1, len(self.base)), 'self.MatchBaseIdx(v:val)')
let self.list = map(copy(self.table), 'self.GetBaseItem(v:val)')
endif
endf


Expand Down Expand Up @@ -574,6 +605,8 @@ function! s:prototype.Reset(...) dict "{{{3
let self.idx = ''
let self.prefidx = 0
let self.initial_display = 1
let self.fmt_display = {}
let self.fmt_filter = {}
call self.UseInputListScratch()
call self.ResetSelected()
call self.Retrieve(!initial)
Expand Down
9 changes: 3 additions & 6 deletions autoload/tlib/agent.vim
Expand Up @@ -3,17 +3,14 @@
" @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: 2009-08-04.
" @Revision: 0.1.172
" @Last Change: 2010-01-05.
" @Revision: 0.1.174

if &cp || exists("loaded_tlib_agent_autoload") "{{{2
finish
endif
let loaded_tlib_agent_autoload = 1

" :filedoc:
" Various agents for use as key handlers in tlib#input#List()


" General {{{1

function! tlib#agent#Exit(world, selected) "{{{3
Expand Down
8 changes: 2 additions & 6 deletions autoload/tlib/autocmdgroup.vim
Expand Up @@ -3,13 +3,9 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2008-08-19.
" @Last Change: 2009-12-07.
" @Revision: 0.0.5
" @Last Change: 2010-01-05.
" @Revision: 0.0.6

if &cp || exists("loaded_tlib_autocmdgroup_autoload")
finish
endif
let loaded_tlib_autocmdgroup_autoload = 1
let s:save_cpo = &cpo
set cpo&vim

Expand Down
8 changes: 2 additions & 6 deletions autoload/tlib/buffer.vim
Expand Up @@ -3,13 +3,9 @@
" @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: 2009-12-07.
" @Revision: 0.0.287
" @Last Change: 2010-01-05.
" @Revision: 0.0.288

if &cp || exists("loaded_tlib_buffer_autoload")
finish
endif
let loaded_tlib_buffer_autoload = 1

let s:bmru = []

Expand Down
9 changes: 2 additions & 7 deletions autoload/tlib/cache.vim
Expand Up @@ -3,13 +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: 2009-02-15.
" @Revision: 0.1.32

if &cp || exists("loaded_tlib_cache_autoload")
finish
endif
let loaded_tlib_cache_autoload = 1
" @Last Change: 2010-01-05.
" @Revision: 0.1.33


" :def: function! tlib#cache#Filename(type, ?file=%, ?mkdir=0)
Expand Down
4 changes: 2 additions & 2 deletions autoload/tlib/file.vim
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: 2009-03-13.
" @Revision: 0.0.67
" @Last Change: 2010-01-04.
" @Revision: 0.0.69

if &cp || exists("loaded_tlib_file_autoload")
finish
Expand Down

0 comments on commit eb07ace

Please sign in to comment.