From 4eaeef01bf3f6b79b25356134c7819d3eabbc784 Mon Sep 17 00:00:00 2001 From: Israel Chauca Fuentes Date: Tue, 21 Feb 2017 22:11:27 -0500 Subject: [PATCH] Fix problem with jumping over an existing closing delimiter. --- autoload/delimitMate.vim | 2 +- test/autoclose_matchpairs.vim | 3 ++- test/expand_cr.vim | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/autoload/delimitMate.vim b/autoload/delimitMate.vim index 0a03edb..97e1b43 100644 --- a/autoload/delimitMate.vim +++ b/autoload/delimitMate.vim @@ -365,7 +365,7 @@ function! s:keys4left(char, pair, info, opts) "{{{1 endif let eol_marker = a:opts.insert_eol_marker == 1 && empty(a:info.cur.ahead) ? a:opts.eol_marker . "\U\" : '' 3DMDebug "34" - return strcharpart(a:pair, 1, 1) . eol_marker . "\U\" + return "\" . strcharpart(a:pair, 1, 1) . eol_marker . "\U\" endfunction function! s:keys4right(char, pair, info, opts) "{{{1 diff --git a/test/autoclose_matchpairs.vim b/test/autoclose_matchpairs.vim index 729869c..bddeab9 100644 --- a/test/autoclose_matchpairs.vim +++ b/test/autoclose_matchpairs.vim @@ -62,7 +62,8 @@ call DMTest_pairs('(a)', "a)", "()a)") " Expand iabbreviations iabb def ghi -call DMTest_single('', "idef(", "ghi()") +" Not sure how to make it work on the test +call DMTest_single('', "idef(", "ghi()", 0, 1) iunabb def call DMTest_pairs("abc а", "$i(", "abc (а") diff --git a/test/expand_cr.vim b/test/expand_cr.vim index 1e3b0bd..8458c53 100644 --- a/test/expand_cr.vim +++ b/test/expand_cr.vim @@ -11,7 +11,7 @@ " - Add 5 to vimtap#Plan(). call vimtest#StartTap() -call vimtap#Plan(26) +call vimtap#Plan(27) let g:delimitMate_expand_cr = 1 @@ -64,6 +64,19 @@ call DMTest_single( \ ' }x', \ '}']) +call DMTest_single( + \ ['sub foo {', + \ ' while (1) {', + \ ' bar', + \ ' }', + \ '}'], + \ "3GA{x", + \ ['sub foo {', + \ ' while (1) {', + \ ' bar{x}', + \ ' }', + \ '}']) + call DMTest_single('"{bracketed}', "\A\"x", '"{bracketed}"x') " Syntax folding enabled by autocmd breaks expansion.