aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-08-14 17:31:29 +0800
committerBas van Kervel <bas@ethdev.com>2015-08-14 19:23:41 +0800
commitc472b8f7257763fb977a595d455999054e48c550 (patch)
tree607003908f65d26f17f69e7a38407e60bcdb2e73 /cmd
parent28b14d3e6d43cb27019e21d0a93a80e7bee1de8c (diff)
downloadgo-tangerine-c472b8f7257763fb977a595d455999054e48c550.tar
go-tangerine-c472b8f7257763fb977a595d455999054e48c550.tar.gz
go-tangerine-c472b8f7257763fb977a595d455999054e48c550.tar.bz2
go-tangerine-c472b8f7257763fb977a595d455999054e48c550.tar.lz
go-tangerine-c472b8f7257763fb977a595d455999054e48c550.tar.xz
go-tangerine-c472b8f7257763fb977a595d455999054e48c550.tar.zst
go-tangerine-c472b8f7257763fb977a595d455999054e48c550.zip
main clear current line on ctrl-C
Diffstat (limited to 'cmd')
-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 ff319ab6b..86bee731f 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, "(")