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

readline: remove new line \n character from readline output, now just Enter produces '' (#18934)

This commit is contained in:
indexxd 2023-07-22 06:01:57 +02:00 committed by GitHub
parent a3449098a9
commit bf00ac656f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,6 +133,10 @@ pub fn (mut r Readline) read_line_utf8(prompt string) ![]rune {
r.disable_raw_mode()
if r.current.len == 0 {
return error('empty line')
} else {
if r.current.last() == `\n` {
r.current.pop()
}
}
return r.current
}