diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index d5a2576..0cc3147 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -67,9 +67,9 @@ let s:shorthand = { \ 'mode_sequence': 'm', 'ignores': 'ig', 'filter': 'f' \ } -if exists("*strwidth") +if exists("*strdisplaywidth") function! s:strwidth(str) - return strwidth(a:str) + len(matchstr(a:str, '^\t*')) * (&tabstop - 1) + return strdisplaywidth(a:str) endfunction else function! s:strwidth(str) diff --git a/test/fixed.vader b/test/fixed.vader index 01145c9..538bf2b 100644 --- a/test/fixed.vader +++ b/test/fixed.vader @@ -117,4 +117,26 @@ Expect: n2gv = {} n2vt = {} +Given (Tab-indented code (#20)): + class MyUnitTest(unittest.TestCase): + def test_base(self): + # n2f= {} + ## n2v= {} + # f2v = {} + ## n2gv = {} + # n2vt = {} + +Execute: + set tabstop=12 + %EasyAlign= + +Expect: + class MyUnitTest(unittest.TestCase): + def test_base(self): + # n2f = {} + ## n2v = {} + # f2v = {} + ## n2gv = {} + # n2vt = {} + Include: include/teardown.vader