From 85f3372a3278554515ccb6199f46dd7e69e5188f Mon Sep 17 00:00:00 2001 From: zakuro Date: Thu, 9 Dec 2021 05:35:21 +0900 Subject: [PATCH] readline: fix bug that full-width spaces are treated as eof (#12763) --- vlib/readline/readline_linux.c.v | 3 +++ vlib/v/tests/repl/println.repl | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/vlib/readline/readline_linux.c.v b/vlib/readline/readline_linux.c.v index 01e947befa..235a7908b2 100644 --- a/vlib/readline/readline_linux.c.v +++ b/vlib/readline/readline_linux.c.v @@ -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 diff --git a/vlib/v/tests/repl/println.repl b/vlib/v/tests/repl/println.repl index e772234935..109e50d7f9 100644 --- a/vlib/v/tests/repl/println.repl +++ b/vlib/v/tests/repl/println.repl @@ -1,3 +1,3 @@ -println('Hello, world! | Привет, мир! | 你好世界') +println('Hello, world! | Привет, мир! | 你好世界 | こんにちは、世界。') ===output=== -Hello, world! | Привет, мир! | 你好世界 +Hello, world! | Привет, мир! | 你好世界 | こんにちは、世界。