diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index 8ae0380..61b66a0 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -507,14 +507,15 @@ function! s:do_align(todo, modes, all_tokens, all_delims, fl, ll, fc, lc, nth, r endif " Before and after the range (for blockwise visual mode) - let cline = getline(line) - let before = strpart(cline, 0, a:fc - 1) - let after = a:lc ? strpart(cline, a:lc) : '' + let cline = getline(line) + let before = strpart(cline, 0, a:fc - 1) + let after = a:lc ? strpart(cline, a:lc) : '' " Determine the left and right margin around the delimiter - let rest = join(tokens[nth + 1 : -1], '') - let ml = empty(prefix . token) ? '' : d.ml - let mr = empty(rest.after) ? '' : d.mr + let rest = join(tokens[nth + 1 : -1], '') + let nomore = empty(rest.after) + let ml = (empty(prefix . token) || empty(delim) && nomore) ? '' : d.ml + let mr = nomore ? '' : d.mr " Adjust indentation of the lines starting with a delimiter let lpad = '' diff --git a/test/commandline.vader b/test/commandline.vader index 92ad53e..4bb9075 100644 --- a/test/commandline.vader +++ b/test/commandline.vader @@ -83,8 +83,8 @@ Execute (merge different option notations): %EasyAlign*/../iu0 { 'l': '<', 'r': '>' } Expect: - ap><:;><;b><:c>e< - da><;;><:;><::> <:;><;b><:c>e + da><;;><:;><::> '} + +Expect: + a <|>b <|>c + aa<|>bb<|>cc + +Given (Trailing delimiter): + a | b | c | + aa | bb | cc | + +Execute: + %EasyAlign*|iu0{'l':'<', 'r': '>'} + +Expect: + a <|>b <|>c <| + aa<|>bb<|>cc<| diff --git a/test/interactive.vader b/test/interactive.vader index 04a370f..300e24d 100644 --- a/test/interactive.vader +++ b/test/interactive.vader @@ -517,15 +517,15 @@ Do (live interactive mode!): \ Expect: - [|] Option[|]Type [|]Default[|]Description [|[ - [|] --[|]-- [|] --[|]-- [|[ - [|] threads[|]Fixnum [|] 1[|]number of threads in the thread pool [|[ - [|] queues[|]Fixnum [|] 1[|]number of concurrent queues [|[ - [|]queue_size[|]Fixnum [|] 1000[|]size of each queue [|[ - [|] interval[|]Numeric[|] 0[|]dispatcher interval for batch processing [|[ - [|] batch[|]Boolean[|] false[|]enables batch processing mode [|[ - [|]batch_size[|]Fixnum [|] nil[|]number of maximum items to be assigned at once[|[ - [|] logger[|]Logger [|] nil[|]logger instance for debug logs [|[ + [|] Option[|]Type [|]Default[|]Description [| + [|] --[|]-- [|] --[|]-- [| + [|] threads[|]Fixnum [|] 1[|]number of threads in the thread pool [| + [|] queues[|]Fixnum [|] 1[|]number of concurrent queues [| + [|]queue_size[|]Fixnum [|] 1000[|]size of each queue [| + [|] interval[|]Numeric[|] 0[|]dispatcher interval for batch processing [| + [|] batch[|]Boolean[|] false[|]enables batch processing mode [| + [|]batch_size[|]Fixnum [|] nil[|]number of maximum items to be assigned at once[| + [|] logger[|]Logger [|] nil[|]logger instance for debug logs [| Execute (g:easy_align_last_command should be set): Assert exists('g:easy_align_last_command')