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

REPL: checks if EOF

Check if newline to not create empty println
This commit is contained in:
Henrixounez 2019-08-09 16:08:36 +02:00 committed by Alexander Medvednikov
parent 7d8b296943
commit a81875b24b

View File

@ -1313,9 +1313,12 @@ fn run_repl() []string {
continue
}
line = line.trim_space()
if line == '' || line == 'exit' {
if line.len == -1 || line == '' || line == 'exit' {
break
}
if line == '\n' {
continue
}
// Save the source only if the user is printing something,
// but don't add this print call to the `lines` array,
// so that it doesn't get called during the next print.