From c472b8f7257763fb977a595d455999054e48c550 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Fri, 14 Aug 2015 11:31:29 +0200 Subject: [PATCH] main clear current line on ctrl-C --- cmd/geth/js.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/geth/js.go b/cmd/geth/js.go index ff319ab6bf..86bee731f2 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -383,6 +383,11 @@ func (self *jsre) interactive() { for { line, err := self.Prompt(<-prompt) if err != nil { + if err == liner.ErrPromptAborted { // ctrl-C + self.resetPrompt() + inputln <- "" + continue + } return } inputln <- line @@ -469,6 +474,12 @@ func (self *jsre) parseInput(code string) { var indentCount = 0 var str = "" +func (self *jsre) resetPrompt() { + indentCount = 0 + str = "" + self.ps1 = "> " +} + func (self *jsre) setIndent() { open := strings.Count(str, "{") open += strings.Count(str, "(")