From 5faa7e78616d80f606870167e8f88845d9dc5c6a Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 17 Oct 2019 03:37:30 +0300 Subject: [PATCH] Revert "repl: add readline for user input " This reverts commit 83732642ac979b92b64a9c8a9c072aa44cb3ff84. --- vlib/compiler/repl.v | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/vlib/compiler/repl.v b/vlib/compiler/repl.v index 9059130d5d..65b613634d 100644 --- a/vlib/compiler/repl.v +++ b/vlib/compiler/repl.v @@ -4,11 +4,8 @@ module compiler -import ( - os - term - readline -) +import os +import term struct Repl { mut: @@ -77,7 +74,6 @@ pub fn run_repl() []string { println('Use Ctrl-C or `exit` to exit') file := '.vrepl.v' temp_file := '.vrepl_temp.v' - mut prompt := '>>> ' defer { os.rm(file) os.rm(temp_file) @@ -85,26 +81,22 @@ pub fn run_repl() []string { os.rm(temp_file.left(temp_file.len - 2)) } mut r := Repl{} - mut readline := readline.Readline{} vexe := os.args[0] for { if r.indent == 0 { - prompt = '>>> ' + print('>>> ') } else { - prompt = '... ' + print('... ') } - mut line := readline.read_line(prompt) or { - break - } - if line.trim_space() == '' && line.ends_with('\n') { + r.line = os.get_raw_line() + if r.line.trim_space() == '' && r.line.ends_with('\n') { continue } - line = line.trim_space() - if line.len <= -1 || line == '' || line == 'exit' { + r.line = r.line.trim_space() + if r.line.len == -1 || r.line == '' || r.line == 'exit' { break } - r.line = line if r.line == '\n' { continue }