Skip to content

Commit

Permalink
fix for CR/LF #553
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jan 1, 2020
1 parent 0e85eee commit 95612b8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/unix_formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,16 +986,23 @@
}
cursor.x += s_len;
};
var use_CR = !!input.match(/\x0D/);
var events = {
inst_p: print,
inst_x: function(flag) {
inst_x: use_CR ? function(flag) {
var code = flag.charCodeAt(0);
if (code === 13) {
cursor.x = 0;
}
if (code === 10) {
cursor.y++;
}
} : function(flag) {
var code = flag.charCodeAt(0);
if (code === 10) {
cursor.x = 0;
cursor.y++;
}
},
inst_c: function(collected, params, flag) {
var value = params[0] === 0 ? 1 : params[0];
Expand Down

0 comments on commit 95612b8

Please sign in to comment.