aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-01-07 13:16:40 +0100
committerDimitri Sokolyuk <demon@dim13.org>2018-01-07 13:16:40 +0100
commit3db68304a75583a2e9ff78e221aa319c6efb9d7f (patch)
treebceb07d16f0b7d1cd62f055759c9c4dbe45c5a9d
parentc48adbaadb077f0e77b81f521f404d8c0fb26f10 (diff)
replace nl with cr
-rw-r--r--console.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/console.go b/console.go
index 9ca2a70..69082ae 100644
--- a/console.go
+++ b/console.go
@@ -19,8 +19,11 @@ func NewConsole() *Console {
func (c *Console) Read(p []byte) (int, error) {
n, err := c.r.Read(p)
- if n > 0 && p[0] == 10 {
- p[0] = 13
+ for i, v := range p {
+ // replace nl with cr
+ if v == 10 {
+ p[i] = 13
+ }
}
return n, err
}