Skip to content

Commit bf00ac6

Browse files
authored
readline: remove new line \n character from readline output, now just Enter produces '' (#18934)
1 parent a344909 commit bf00ac6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vlib/readline/readline_nix.c.v

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ pub fn (mut r Readline) read_line_utf8(prompt string) ![]rune {
133133
r.disable_raw_mode()
134134
if r.current.len == 0 {
135135
return error('empty line')
136+
} else {
137+
if r.current.last() == `\n` {
138+
r.current.pop()
139+
}
136140
}
137141
return r.current
138142
}

0 commit comments

Comments
 (0)