mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-10 10:53:49 -05:00
fix to preserve trailing whitespaces from prefix when delimiter sticks to left
This commit is contained in:
@@ -31,7 +31,7 @@ function! s:do_align(just, fl, ll, fc, lc, pattern, nth, ml, mr, stick_to_left,
|
|||||||
let max_just_len = 0
|
let max_just_len = 0
|
||||||
let max_delim_len = 0
|
let max_delim_len = 0
|
||||||
let max_tokens = 0
|
let max_tokens = 0
|
||||||
let pattern = '\s*\(' .a:pattern. '\)\s\{-}'
|
let pattern = '\s*\(' .a:pattern. '\)\s' . (a:stick_to_left ? '*' : '\{-}')
|
||||||
for line in range(a:fl, a:ll)
|
for line in range(a:fl, a:ll)
|
||||||
let tokens = split(a:lc ?
|
let tokens = split(a:lc ?
|
||||||
\ strpart(getline(line), a:fc - 1, a:lc - a:fc + 1) :
|
\ strpart(getline(line), a:fc - 1, a:lc - a:fc + 1) :
|
||||||
@@ -58,7 +58,7 @@ function! s:do_align(just, fl, ll, fc, lc, pattern, nth, ml, mr, stick_to_left,
|
|||||||
let nth = len(tokens) + a:nth
|
let nth = len(tokens) + a:nth
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if nth < 0
|
if nth < 0 || nth == len(tokens)
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user