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:

committed by
Alexander Medvednikov

parent
f042dfb861
commit
f1bb25bfaf
@ -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 {
|
||||
|
Reference in New Issue
Block a user