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

readline: fix bug that full-width spaces are treated as eof (#12763)

This commit is contained in:
zakuro 2021-12-09 05:35:21 +09:00 committed by GitHub
parent 7379488cee
commit 85f3372a32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -200,6 +200,9 @@ pub fn read_line(prompt string) ?string {
// analyse returns an `Action` based on the type of input byte given in `c`. // analyse returns an `Action` based on the type of input byte given in `c`.
fn (r Readline) analyse(c int) Action { fn (r Readline) analyse(c int) Action {
if c > 255 {
return Action.insert_character
}
match byte(c) { match byte(c) {
`\0`, 0x3, 0x4, 255 { `\0`, 0x3, 0x4, 255 {
return .eof return .eof

View File

@ -1,3 +1,3 @@
println('Hello, world! | Привет, мир! | 你好世界') println('Hello, world! | Привет, мир! | 你好世界 | こんにちは、世界。')
===output=== ===output===
Hello, world! | Привет, мир! | 你好世界 Hello, world! | Привет, мир! | 你好世界 | こんにちは、世界。