Skip to content

Commit

Permalink
ansi2html.sh: further fixes to remove extraneous spaces at EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Sweetman authored and pixelb committed May 9, 2014
1 parent 4129db4 commit ca43a10
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scripts/ansi2html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
# Handle codes with combined attributes and color.
# Handle isolated <bold> attributes with css.
# Strip more terminal control codes.
# V0.17, 08 May 2014
# V0.18, 08 May 2014
# http://github.com/pixelb/scripts/commits/master/scripts/ansi2html.sh

if [ "$1" = "--version" ]; then
printf '0.17\n' && exit
printf '0.18\n' && exit
fi

if [ "$1" = "--help" ]; then
Expand Down Expand Up @@ -292,12 +292,9 @@ s#\x0F#µ#g
awk '
function dump_line(l,del,c,blanks,ret) {
for(c=1;c<maxX;c++) {
if ((c SUBSEP l) in attr || length(cur) &&
(length(blanks) || (c SUBSEP l) in dump)) {
if(del) {
ret = ret fixas(cur,attr[c,l])
delete attr[c,l]
} else ret = ret blanks fixas(cur,attr[c,l])
if ((c SUBSEP l) in attr || length(cur)) {
ret = ret blanks fixas(cur,attr[c,l])
if(del) delete attr[c,l]
blanks=""
}
if ((c SUBSEP l) in dump) {
Expand Down Expand Up @@ -402,6 +399,7 @@ function encode(string,start,end,i,ret,pos,sc,buf) {
}
else if(c=="\b") {
# backspace move insertion point back 1
if(spc) attr[x,y]=atos(span)
x=x>1?x-1:1
continue
}
Expand Down

0 comments on commit ca43a10

Please sign in to comment.