mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
Moved esc seq table out of copyBuffer to avoid redecls
This commit is contained in:
parent
dbaa8b5b62
commit
952279a108
1 changed files with 8 additions and 5 deletions
13
xs/xs.go
13
xs/xs.go
|
@ -102,6 +102,14 @@ type (
|
|||
escSeqs map[byte]escHandler
|
||||
)
|
||||
|
||||
var (
|
||||
escs = escSeqs{
|
||||
'i': func(io.Writer) { os.Stdout.Write([]byte("\x1b[s\x1b[2;1H\x1b[1;31m[HKEXSH]\x1b[39;49m\x1b[u")) },
|
||||
't': func(io.Writer) { os.Stdout.Write([]byte("\x1b[1;32m[HKEXSH]\x1b[39;49m")) },
|
||||
'B': func(io.Writer) { os.Stdout.Write([]byte("\x1b[1;32m" + bob + "\x1b[39;49m")) },
|
||||
}
|
||||
)
|
||||
|
||||
// Copy copies from src to dst until either EOF is reached
|
||||
// on src or an error occurs. It returns the number of bytes
|
||||
// copied and the first error encountered while copying, if any.
|
||||
|
@ -149,11 +157,6 @@ func copyBuffer(dst io.Writer, src io.Reader, buf []byte) (written int64, err er
|
|||
// or tunnel traffic indicator - note we cannot just spawn a goroutine
|
||||
// here, as copyBuffer() returns after each burst of data. Scope must
|
||||
// outlive individual copyBuffer calls).
|
||||
escs := escSeqs{
|
||||
'i': func(io.Writer) { os.Stdout.Write([]byte("\x1b[s\x1b[2;1H\x1b[1;31m[HKEXSH]\x1b[39;49m\x1b[u")) },
|
||||
't': func(io.Writer) { os.Stdout.Write([]byte("\x1b[1;32m[HKEXSH]\x1b[39;49m")) },
|
||||
'B': func(io.Writer) { os.Stdout.Write([]byte("\x1b[1;32m" + bob + "\x1b[39;49m")) },
|
||||
}
|
||||
|
||||
/*
|
||||
// If the reader has a WriteTo method, use it to do the copy.
|
||||
|
|
Loading…
Reference in a new issue