Skip to content

Commit

Permalink
Version 1.84
Browse files Browse the repository at this point in the history
- Pin down the 'virtualedit' setting (to "onemore") during CountJump#TextObject#TextObjectWithJumpFunctions() to avoid that a characterwise outer text object that ends at the end of a line includes the line's newline character when 'selection' is "exclusive".
- FIX: There are no buffer-local functions with a b: scope prefix, and Vim 7.4.264 disallows those invalid function names now. Previously, multiple buffer-local text objects with the same key would override each other. Instead, make the functions created by CountJump#TextObject#MakeWithCountSearch() and CountJump#Region#TextObject#Make() buffer-scoped by prefixing "s:B" and the buffer number.
  • Loading branch information
Ingo Karkat authored and vim-scripts committed Apr 27, 2014
1 parent c2c7725 commit 81c678e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -47,7 +47,7 @@ RELATED WORKS
- motpat.vim (vimscript #3030) offers similar functions to setup motion
mappings, but no text objects (yet).
- textobj-user (vimscript #2100) has support for user-defined text objects via
regular expressions.
regular expressions, but they don't support selecting multiple via [count].
- movealong.vim (vimscript #4691) provides a :Movealong command (and optional
mappings) that repeatedly executes a motion until a condition of a syntax,
pattern match, or arbitrary expression is met.
Expand Down
14 changes: 11 additions & 3 deletions autoload/CountJump/Region/TextObject.vim
Expand Up @@ -3,12 +3,20 @@
" DEPENDENCIES:
" - CountJump/Mappings.vim, CountJump/Region.vim, CountJump/TextObjects.vim autoload scripts
"
" Copyright: (C) 2010-2013 Ingo Karkat
" Copyright: (C) 2010-2014 Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'.
"
" Maintainer: Ingo Karkat <ingo@karkat.de>
"
" REVISION DATE REMARKS
" 1.84.005 24-Apr-2014 FIX: There are no buffer-local functions with a
" b: scope prefix, and Vim 7.4.264 disallows those
" invalid function names now. Previously, multiple
" buffer-local text objects with the same key
" would override each other. Instead, make the
" functions created by
" CountJump#Region#TextObject#Make() buffer-scoped
" by prefixing "s:B" and the buffer number.
" 1.83.004 14-Jun-2013 Minor: Make substitute() robust against
" 'ignorecase'.
" 1.60.003 27-Mar-2012 ENH: When keys start with <Plug>, insert Inner /
Expand Down Expand Up @@ -68,12 +76,12 @@ function! CountJump#Region#TextObject#Make( mapArgs, textObjectKey, types, selec
"* RETURN VALUES:
" None.
"*******************************************************************************
let l:scope = (a:mapArgs =~# '<buffer>' ? 'b:' : 's:')

if a:types !~# '^[ai]\+$'
throw "ASSERT: Type must consist of 'a' and/or 'i', but is: '" . a:types . "'"
endif

let l:scope = (a:mapArgs =~# '<buffer>' ? 's:B' . bufnr('') : 's:')

" If only either an inner or outer text object is defined, the generated
" function must include the type, so that it is possible to separately
" define a text object of the other type (via a second invocation of this
Expand Down
25 changes: 22 additions & 3 deletions autoload/CountJump/TextObject.vim
Expand Up @@ -3,12 +3,28 @@
" DEPENDENCIES:
" - CountJump.vim, CountJump/Mappings.vim autoload scripts
"
" Copyright: (C) 2009-2013 Ingo Karkat
" Copyright: (C) 2009-2014 Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'.
"
" Maintainer: Ingo Karkat <ingo@karkat.de>
"
" REVISION DATE REMARKS
" 1.84.017 24-Apr-2014 FIX: There are no buffer-local functions with a
" b: scope prefix, and Vim 7.4.264 disallows those
" invalid function names now. Previously, multiple
" buffer-local text objects with the same key
" would override each other. Instead, make the
" functions created by
" CountJump#TextObject#MakeWithCountSearch()
" buffer-scoped by prefixing "s:B" and the buffer
" number.
" 1.84.016 22-Apr-2014 Pin down the 'virtualedit' setting (to
" "onemore") during
" CountJump#TextObject#TextObjectWithJumpFunctions()
" to avoid that a characterwise outer text object
" that ends at the end of a line includes the
" line's newline character when 'selection' is
" "exclusive".
" 1.83.015 14-Jun-2013 Minor: Make substitute() robust against
" 'ignorecase'.
" 1.82.014 30-Oct-2012 FIX: In text objects, when the end position is
Expand Down Expand Up @@ -155,6 +171,8 @@ function! CountJump#TextObject#TextObjectWithJumpFunctions( mode, isInner, isExc
let g:CountJump_Context = {}

let l:save_whichwrap = &whichwrap
let l:save_virtualedit = &virtualedit
set virtualedit=onemore " Need to move beyond the current line for proper selection of an end position at the end of the line when 'selection' is "exclusive"; otherwise, the "l" motion would select the newline, too.
set whichwrap+=h,l
try
let l:beginPosition = call(a:JumpToBegin, [1, a:isInner])
Expand Down Expand Up @@ -249,6 +267,7 @@ function! CountJump#TextObject#TextObjectWithJumpFunctions( mode, isInner, isExc
normal! gv
endif
finally
let &virtualedit = l:save_virtualedit
let &whichwrap = l:save_whichwrap
endtry
endfunction
Expand Down Expand Up @@ -391,12 +410,12 @@ function! CountJump#TextObject#MakeWithCountSearch( mapArgs, textObjectKey, type
"* RETURN VALUES:
" None.
"*******************************************************************************
let l:scope = (a:mapArgs =~# '<buffer>' ? 'b:' : 's:')

if a:types !~# '^[ai]\+$'
throw "ASSERT: Type must consist of 'a' and/or 'i', but is: '" . a:types . "'"
endif

let l:scope = (a:mapArgs =~# '<buffer>' ? 's:B' . bufnr('') : 's:')

" If only either an inner or outer text object is defined, the generated
" function must include the type, so that it is possible to separately
" define a text object of the other type (via a second invocation of this
Expand Down
15 changes: 14 additions & 1 deletion doc/CountJump.txt
Expand Up @@ -64,7 +64,7 @@ RELATED WORKS *
- motpat.vim (vimscript #3030) offers similar functions to setup motion
mappings, but no text objects (yet).
- textobj-user (vimscript #2100) has support for user-defined text objects via
regular expressions.
regular expressions, but they don't support selecting multiple via [count].
- movealong.vim (vimscript #4691) provides a :Movealong command (and optional
mappings) that repeatedly executes a motion until a condition of a syntax,
pattern match, or arbitrary expression is met.
Expand Down Expand Up @@ -254,6 +254,19 @@ IDEAS *CountJump-ideas*
==============================================================================
HISTORY *CountJump-history*

1.84 25-Apr-2014
- Pin down the 'virtualedit' setting (to "onemore") during
CountJump#TextObject#TextObjectWithJumpFunctions() to avoid that a
characterwise outer text object that ends at the end of a line includes the
line's newline character when 'selection' is "exclusive".
- FIX: There are no buffer-local functions with a b: scope prefix, and Vim
7.4.264 disallows those invalid function names now. Previously, multiple
buffer-local text objects with the same key would override each other.
Instead, make the functions created by
CountJump#TextObject#MakeWithCountSearch() and
CountJump#Region#TextObject#Make() buffer-scoped by prefixing "s:B" and the
buffer number.

1.83 23-Jan-2014
- Use more canonical way of invoking the Funcrefs in
CountJump#Motion#MakeBracketMotionWithJumpFunctions(); this will then also
Expand Down

0 comments on commit 81c678e

Please sign in to comment.