Commit graph

11 commits

Author SHA1 Message Date
Aleksa Sarai
4045484afb
vis: rewrite to use byte slices
This results in all multi-byte characters to be encoded in a way that
naive unvis(3) implementations will not bork up the encoding. In
addition, it also ensures that the output of Vis will always be ASCII
*only*.

Also test far more cases in *_test.go when it comes to different flags,
and do far more tests to ensure that the output of Vis() makes sense.
These outputs come directly from vis(3) and so are useful regression
tests to ensure that the handling of Vis() is identical to the original.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-16 01:07:16 +11:00
Aleksa Sarai
c2a9f1a56d
flags -> govis
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-14 02:11:41 +11:00
Aleksa Sarai
de223ffc92
unvis: implement meta and ctrl characters ('\M__' and '\^_')
While these characters are really weird to handle, here is a fairly
simple implementation that need some more testing (and a proper
secondary source to compare against).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-13 08:03:04 +11:00
Aleksa Sarai
7b16f3a307
travis: add .travis.yml
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-13 07:43:24 +11:00
Aleksa Sarai
35708696fe
unvis: implement proper '\xff' and '\377' escape handling
In particular, previously such escape handling would break because we
would attempt to encode characters >0x7f as runes -- which would then
result in escapes that want to encode multi-byte characters breaking.

There's still some work necessary in Vis() to make it act sanely when it
comes to arbitrary bit streams. Not to mention that we need to figure
out what we actually want to do there...

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-13 04:53:14 +11:00
Aleksa Sarai
3b18d38388
govis: add integration tests
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-12 04:08:21 +11:00
Aleksa Sarai
44391840b6
vis: partial vis(3) port
This is a stopgap while I figure out how I should go about implementing
vis(3). It's also important to have some vis(3) implementation so I can
do integration tests on round-trips.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-12 04:07:37 +11:00
Aleksa Sarai
cd1de45ba5
unvis: implement partial unvis(3) implementation
Also add some unit tests -- one of which currently fails due to ongoing
design discussion about how certain escape codes should be handled.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-12 04:06:25 +11:00
Aleksa Sarai
1e8de82690
*: license under Apache 2.0
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-11 21:10:12 +11:00
Aleksa Sarai
4c009fc4b2
README: add stub readme
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-11 21:09:06 +11:00
Aleksa Sarai
85e7fd2d50
initial commit
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-02-11 21:07:17 +11:00