diff options
author | Felix Lange <fjl@twurst.com> | 2015-08-12 00:14:46 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-08-12 18:04:00 +0800 |
commit | 0ef80bb3d05ecb44297d25c889a85555bc55ef0c (patch) | |
tree | e20fd801a5cd219ee8e5dcf82acd003a44bb02e5 /Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go | |
parent | 05c66529b2c22fba20c55a69c4817395c532d4c8 (diff) | |
download | go-tangerine-0ef80bb3d05ecb44297d25c889a85555bc55ef0c.tar go-tangerine-0ef80bb3d05ecb44297d25c889a85555bc55ef0c.tar.gz go-tangerine-0ef80bb3d05ecb44297d25c889a85555bc55ef0c.tar.bz2 go-tangerine-0ef80bb3d05ecb44297d25c889a85555bc55ef0c.tar.lz go-tangerine-0ef80bb3d05ecb44297d25c889a85555bc55ef0c.tar.xz go-tangerine-0ef80bb3d05ecb44297d25c889a85555bc55ef0c.tar.zst go-tangerine-0ef80bb3d05ecb44297d25c889a85555bc55ef0c.zip |
cmd/geth, jsre: restore command line editing on windows
PR #856 broke command line editing by wrapping stdout with a filter that
interprets ANSI escape sequences to fix colored printing on windows.
Implement the printer in Go instead so it can do its own
platform-dependent coloring.
As a nice side effect, the JS console is now noticeably more responsive
when printing results.
Fixes #1608
Fixes #1612
Diffstat (limited to 'Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go new file mode 100644 index 000000000..d3ece8fc0 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go @@ -0,0 +1,20 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// Package ansicolor provides color console in Windows as ANSICON. +package ansicolor + +import "io" + +// NewAnsiColorWriter creates and initializes a new ansiColorWriter +// using io.Writer w as its initial contents. +// In the console of Windows, which change the foreground and background +// colors of the text by the escape sequence. +// In the console of other systems, which writes to w all text. +func NewAnsiColorWriter(w io.Writer) io.Writer { + if _, ok := w.(*ansiColorWriter); !ok { + return &ansiColorWriter{w: w} + } + return w +} |