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

pull/12769/head
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`.
fn (r Readline) analyse(c int) Action {
if c > 255 {
return Action.insert_character
}
match byte(c) {
`\0`, 0x3, 0x4, 255 {
return .eof

View File

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