Skip to content

Commit

Permalink
fix: Exclude tab chars by adjusting the regex in doge#token#replace
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Jul 20, 2019
1 parent 83df9d1 commit 1290981
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion autoload/doge/token.vim
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ function! s:token_replace(tokens, text) abort

" Replace 2 or more white-spaces with 1 single white-space, except for leading
" white-spaces and/or newlines. Those should be preserved.
let l:text = substitute(l:text, '\m\(^\|\s\|\n\)\@<!\s\{2,}', ' ', 'g')
"
" NOTE: Initially the regex contained '\@<!\s\{2,}' but since '\s' equals
" <Space> and <Tab> characters we have to use specifically ' ' as a space
" character to ensure only spaces will be checked.
let l:text = substitute(l:text, '\m\(^\|\s\|\n\)\@<! \{2,}', ' ', 'g')

" Remove trailing whitespace.
let l:text = substitute(l:text, '\m\s\+$', '', 'g')
Expand Down

0 comments on commit 1290981

Please sign in to comment.