From 8a8aad183f7529632fda6d93a666cbe6c163c8f9 Mon Sep 17 00:00:00 2001 From: Israel Chauca Fuentes Date: Tue, 18 Jun 2013 17:01:56 -0400 Subject: [PATCH] Fix tests, BS in expansions and close #105. --- autoload/delimitMate.vim | 2 +- plugin/delimitMate.vim | 2 +- test/autoclose_quotes.txt | 2 ++ test/expand_cr.txt | 6 ++++-- test/expand_space.txt | 2 ++ 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/autoload/delimitMate.vim b/autoload/delimitMate.vim index 83c0ea8..7ec8add 100644 --- a/autoload/delimitMate.vim +++ b/autoload/delimitMate.vim @@ -143,7 +143,7 @@ function! delimitMate#WriteAfter(str) "{{{ let len = 1 "len(a:str) let line = split(getline('.'), '\zs') let col = delimitMate#CursorIdx() - 1 - if (col + 1) < 0 + if (col + 1) < 0 || col('.') == 1 let line = insert(line, a:str) elseif col('.') == col('$') let line = add(line, a:str) diff --git a/plugin/delimitMate.vim b/plugin/delimitMate.vim index a2c2c1b..5ae3586 100644 --- a/plugin/delimitMate.vim +++ b/plugin/delimitMate.vim @@ -338,7 +338,7 @@ endfunction "}}} function! s:ExtraMappings() "{{{ " If pair is empty, delete both delimiters: - inoremap delimitMateBS delimitMate#WithinEmptyPair() ? "\=delimitMate#BS()\" : "\" + inoremap delimitMateBS =delimitMate#BS() if !hasmapto('delimitMateBS','i') && maparg(''. 'i') == '' silent! imap delimitMateBS endif diff --git a/test/autoclose_quotes.txt b/test/autoclose_quotes.txt index ed768b8..79187ba 100644 --- a/test/autoclose_quotes.txt +++ b/test/autoclose_quotes.txt @@ -36,3 +36,5 @@ set cpo=ces$ " 'x" " 'x'" # Make sure we jump over a quote on the right. #89. "('test'x" "('test'x)" +# Duplicate whole line when inserting quote at bol #105 +"}\'" "''}" diff --git a/test/expand_cr.txt b/test/expand_cr.txt index 190768b..4ed1218 100644 --- a/test/expand_cr.txt +++ b/test/expand_cr.txt @@ -12,6 +12,8 @@ $(document).ready(function() { -------------------------------------------------------------------------------- # Issue #95 new +let b:delimitMate_jump_expansion = 1 +DelimitMateReload exec "normal i(\test)x" ================================================================================ ( @@ -43,10 +45,10 @@ sub foo { } -------------------------------------------------------------------------------- %d -call setline(1, "\"{bracketed}") +call setline(1, '"{bracketed}') normal A"x ================================================================================ -"{bracketed""x +"{bracketed}"x" -------------------------------------------------------------------------------- # Syntax folding enabled by autocmd breaks expansion. But ti can't be tested # with :normal diff --git a/test/expand_space.txt b/test/expand_space.txt index cc79092..39f8748 100644 --- a/test/expand_space.txt +++ b/test/expand_space.txt @@ -1,5 +1,7 @@ # Issue #95 new +let b:delimitMate_jump_expansion = 1 +DelimitMateReload exec "normal i( test)x" ================================================================================ ( test )x