aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-14 19:36:15 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-14 19:36:15 +0800
commitcd81356acef707e077622791a88864a221fa13be (patch)
tree59d919fb3424db00304102dc23a01e0ba1a90523
parent3a66c4ed477cde437705f02811225fa11b0ae5ff (diff)
parentc472b8f7257763fb977a595d455999054e48c550 (diff)
downloaddexon-cd81356acef707e077622791a88864a221fa13be.tar
dexon-cd81356acef707e077622791a88864a221fa13be.tar.gz
dexon-cd81356acef707e077622791a88864a221fa13be.tar.bz2
dexon-cd81356acef707e077622791a88864a221fa13be.tar.lz
dexon-cd81356acef707e077622791a88864a221fa13be.tar.xz
dexon-cd81356acef707e077622791a88864a221fa13be.tar.zst
dexon-cd81356acef707e077622791a88864a221fa13be.zip
Merge pull request #1658 from bas-vk/liner-ctrl-c
Clear current line on ctrl-C
-rw-r--r--cmd/geth/js.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 1ca59e2f4..04b44d6a9 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
@@ -467,6 +472,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, "(")