Fix: right margin sometimes not attached in partial alignment

This commit is contained in:
Junegunn Choi
2013-10-13 02:09:06 +09:00
parent ad2df21039
commit 7b82a1e496
2 changed files with 14 additions and 2 deletions

View File

@@ -511,8 +511,7 @@ function! s:do_align(modes, all_tokens, all_delims, fl, ll, fc, lc, pattern, nth
" Determine the left and right margin around the delimiter
let rest = join(tokens[nth + 1 : -1], '')
let ml = empty(prefix . token) ? '' : a:ml
let mr = (empty(rest) ||
\ (empty(rest) && stridx(after, a:mr) == 0)) ? '' : a:mr
let mr = empty(rest.after) ? '' : a:mr
" Adjust indentation of the lines starting with a delimiter
let lpad = ''

View File

@@ -1283,3 +1283,16 @@ Expect:
a = b = c
aabba = bbbbb
Given (Table):
|a|b|c|d|
| -|-|>-|-|
|aaa|bbb|ccc|ddd|
Do (Partial alignment around 1st |):
\<C-V>ljj\<Enter>|
Expect (Right margin correctly attached):
| a|b|c|d|
| -|-|>-|-|
| aaa|bbb|ccc|ddd|