Skip to content
Snippets Groups Projects
Commit 81135a70 authored by rswindell's avatar rswindell
Browse files

Revert to previous ANSI rendering by default (CRLF to end a line).

Set ansi_crlf = false to use the relative cursor-positioning instead
(only works if not at last line already).
A more detailed error when when attempting to draw outside of screen.
parent 480d0a9a
Branches
Tags
No related merge requests found
...@@ -39,6 +39,7 @@ function Graphic(w,h,attr,ch) ...@@ -39,6 +39,7 @@ function Graphic(w,h,attr,ch)
this.atcodes=true; this.atcodes=true;
this.cpm_eof=true; this.cpm_eof=true;
this.attr_mask=0xff; this.attr_mask=0xff;
this.ansi_crlf=true;
this.data=new Array(this.width); this.data=new Array(this.width);
for(var y=0; y<this.height; y++) { for(var y=0; y<this.height; y++) {
...@@ -135,8 +136,12 @@ Object.defineProperty(Graphic.prototype, "ANSI", { ...@@ -135,8 +136,12 @@ Object.defineProperty(Graphic.prototype, "ANSI", {
// if(char == ' ' || (x<this.width-1)) // if(char == ' ' || (x<this.width-1))
ansi += char; ansi += char;
} }
ansi += this.ansi.cursor_position.move('down'); if(this.ansi_crlf)
ansi += this.ansi.cursor_position.move('left', this.width); ansi += '\r\n';
else {
ansi += this.ansi.cursor_position.move('down');
ansi += this.ansi.cursor_position.move('left', this.width);
}
} }
return ansi; return ansi;
}, },
...@@ -415,7 +420,8 @@ Graphic.prototype.draw = function(xpos,ypos,width,height,xoff,yoff,delay) ...@@ -415,7 +420,8 @@ Graphic.prototype.draw = function(xpos,ypos,width,height,xoff,yoff,delay)
return(false); return(false);
} }
if(xpos+width-1 > console.screen_columns || ypos+height-1 > console.screen_rows) { if(xpos+width-1 > console.screen_columns || ypos+height-1 > console.screen_rows) {
alert("Attempt to draw outside of screen: " + (xpos+width-1) + "x" + (ypos+height-1)); alert("Attempt to draw outside of screen: " + (xpos+width-1) + "x" + (ypos+height-1)
+ format(" > %ux%u", console.screen_columns, console.screen_rows));
return(false); return(false);
} }
for(y=0;y<height; y++) { for(y=0;y<height; y++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment