1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:10:04 +08:00

Fix code runner encoding (#3184)

This commit is contained in:
Wang Shidong 2019-10-23 21:58:02 +08:00 committed by GitHub
parent 59fe4d4fde
commit abe59e3d23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,8 @@ let s:BUFFER = SpaceVim#api#import('vim#buffer')
let s:STRING = SpaceVim#api#import('data#string')
let s:FILE = SpaceVim#api#import('file')
let s:VIM = SpaceVim#api#import('vim')
let s:SYS = SpaceVim#api#import('system')
let s:ICONV = SpaceVim#api#import('iconv')
let s:runners = {}
@ -259,7 +261,11 @@ if has('nvim') && exists('*chanclose')
else
let lines = s:_out_data
endif
if s:SYS.isWindows
let lines = map(lines, 's:ICONV.iconv(v:val, "cp936", "utf-8")')
endif
if !empty(lines)
let lines = map(lines, "substitute(v:val, ' $', '', 'g')")
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines)
call s:VIM.win_set_cursor(s:winid, [s:VIM.buf_line_count(s:bufnr), 1])
endif