mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-10 10:53:49 -05:00
Do not attach margin_left string before phantom token
This commit is contained in:
@@ -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 = ''
|
||||
|
||||
@@ -83,8 +83,8 @@ Execute (merge different option notations):
|
||||
%EasyAlign*/../iu0 { 'l': '<', 'r': '>' }
|
||||
|
||||
Expect:
|
||||
ap><pl><e;><:;><;b><an><an><a:><:c><ak>e<
|
||||
da><ta><;;><ex><ch><an><ge><:;><::><fo> <rm><at<
|
||||
ap><pl><e;><:;><;b><an><an><a:><:c><ak>e
|
||||
da><ta><;;><ex><ch><an><ge><:;><::><fo> <rm><at
|
||||
|
||||
Given javascript (json):
|
||||
var jdbc = {
|
||||
|
||||
@@ -19,3 +19,24 @@ Execute (Aligning lines with many delimiters should not fail):
|
||||
%EasyAlign*|
|
||||
AssertEqual (&maxfuncdepth + 1) * 3 - 2, len(getline(1))
|
||||
|
||||
Given:
|
||||
a | b | c
|
||||
aa | bb | cc
|
||||
|
||||
Execute:
|
||||
%EasyAlign*|iu0{'l':'<', 'r': '>'}
|
||||
|
||||
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<|
|
||||
|
||||
@@ -517,15 +517,15 @@ Do (live interactive mode!):
|
||||
\<C-X>
|
||||
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user