Skip to content

Commit

Permalink
fix: encoding on windows
Browse files Browse the repository at this point in the history
refer: #2849
  • Loading branch information
lervag committed Dec 15, 2023
1 parent 29b6c05 commit 74332a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autoload/vimtex/jobs.vim
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function! vimtex#jobs#capture(cmd, ...) abort " {{{1
call vimtex#paths#popd()

" On Windows there may be trailing CR characters
return has('win32')
\ ? map(l:output, {_, x -> substitute(x, '\r$', '', '')})
return vimtex#util#is_win()
\ ? vimtex#util#win_clean_output(l:output)
\ : l:output
endfunction

Expand Down
10 changes: 10 additions & 0 deletions autoload/vimtex/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ function! vimtex#util#is_win() abort " {{{1
return has('win32') || has('win32unix')
endfunction

" }}}1
function! vimtex#util#win_clean_output(lines) abort " {{{1
let l:lines = map(a:lines, {_, x -> substitute(x, '\r$', '', '')})
return map(l:lines, {_, x ->
\ match(x, '[\x80-\x9F]') > 0
\ ? iconv(x, 'windows-1252', 'utf-8')
\ : x
\})
endfunction

" }}}1
function! vimtex#util#extend_recursive(dict1, dict2, ...) abort " {{{1
let l:option = a:0 > 0 ? a:1 : 'force'
Expand Down

0 comments on commit 74332a6

Please sign in to comment.