1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

windows: Unicode input in REPL

This commit is contained in:
vitalyster
2019-09-20 17:03:13 +03:00
committed by Alexander Medvednikov
parent f042dfb861
commit f1bb25bfaf
5 changed files with 21 additions and 11 deletions

View File

@ -469,10 +469,10 @@ pub fn get_line() string {
pub fn get_raw_line() string {
$if windows {
maxlinechars := 256
buf := &u16(malloc(maxlinechars*2))
buf := &byte(malloc(maxlinechars*2))
res := int( C.fgetws(buf, maxlinechars, C.stdin ) )
len := int( C.wcslen(buf) )
if 0 != res { return string_from_wide2( buf, len ) }
len := int( C.wcslen(&u16(buf)) )
if 0 != res { return string_from_wide2( &u16(buf), len ) }
return ''
}
$else {