diff --git a/exec/load/frame.js b/exec/load/frame.js index 3dd0f5ade41207ce3953601a1033e8a2478c01a4..5c2dafb3ce3717fc40ffeaed2a4209dcf5c9e0a6 100644 --- a/exec/load/frame.js +++ b/exec/load/frame.js @@ -118,6 +118,7 @@ function Frame(x,y,width,height,attr,parent) { display:undefined, data:[], open:false, + ctrl_a:false, id:0 } var settings = { @@ -707,7 +708,6 @@ function Frame(x,y,width,height,attr,parent) { if(str == undefined) return; str = str.toString().split(''); - var control_a = false; var curattr = attr; if(!curattr) curattr = this.attr; @@ -715,7 +715,7 @@ function Frame(x,y,width,height,attr,parent) { while(str.length > 0) { var ch = str.shift(); - if(control_a) { + if(properties.ctrl_a) { var k = ch; if(k) k = k.toUpperCase(); @@ -804,12 +804,12 @@ function Frame(x,y,width,height,attr,parent) { pos.x+=ch.charCodeAt(0)-127; break; } - control_a = false; + properties.ctrl_a = false; } else { switch(ch) { case '\1': /* CTRL-A code */ - control_a = true; + properties.ctrl_a = true; break; case '\7': /* Beep */ break; diff --git a/exec/load/inputline.js b/exec/load/inputline.js index 6fd3f33e9ae2ba7ee3721627a9582688362f40ff..e062a3928fca009616c9945f25555854f2bc6bde 100644 --- a/exec/load/inputline.js +++ b/exec/load/inputline.js @@ -8,13 +8,15 @@ function InputLine(frame,text) { var properties = { frame:undefined, text:undefined, + attr:undefined, buffer:[] }; var settings = { show_border:true, show_title:true, + auto_clear:true, timeout:10, - max_buffer:200 + max_buffer:200, }; /* protected properties */ @@ -22,12 +24,26 @@ function InputLine(frame,text) { return properties.frame; }); this.__defineGetter__("max_buffer",function() { - return properties.max_buffer; + return settings.max_buffer; }); this.__defineSetter__("max_buffer",function(num) { if(num > 0 && num < 10000) settings.max_buffer = Number(num); }); + this.__defineGetter__("auto_clear",function() { + return settings.auto_clear; + }); + this.__defineSetter__("auto_clear",function(bool) { + if(typeof bool == "boolean") + settings.auto_clear = bool; + }); + this.__defineGetter__("attr",function() { + return properties.frame.attr; + }); + this.__defineSetter__("attr",function(num) { + if(num >= 0 && num < 512) + properties.frame.attr = Number(num); + }); this.__defineGetter__("timeout",function() { return properties.timeout; }); @@ -40,12 +56,6 @@ function InputLine(frame,text) { return properties.buffer; }); - /* public properties */ - this.colors = { - bg:BG_BLUE, - fg:WHITE - }; - /* public methods */ this.clear = function() { reset(); @@ -97,8 +107,7 @@ function InputLine(frame,text) { return bufferKey(key); } } - this.init = function(x,y,w,h,frame) { - var attr = this.colors.bg + this.colors.fg; + this.init = function(x,y,w,h,frame,attr) { properties.frame = new Frame(x,y,w,h,attr,frame); properties.frame.v_scroll = false; properties.frame.h_scroll = true; @@ -120,7 +129,7 @@ function InputLine(frame,text) { if(properties.buffer.length>properties.frame.width) printBuffer(); else - properties.frame.putmsg(key); + properties.frame.putmsg(key,properties.frame.attr); return undefined; } function backspace() { @@ -162,7 +171,8 @@ function InputLine(frame,text) { } } var cmd=properties.buffer; - reset(); + if(settings.auto_clear) + reset(); return cmd; } function init(frame,text) {