feature(terminal) add Size

This commit is contained in:
coderaiser 2014-02-04 11:04:27 -05:00
parent 08bfe66a26
commit 8c4fe43aeb

View file

@ -16,6 +16,11 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
Images = DOM.Images,
Notify = DOM.Notify,
Size = {
cols: 0,
rows: 0
},
CHANNEL = CloudFunc.CHANNEL_TERMINAL,
CHANNEL_RESIZE = CloudFunc.CHANNEL_TERMINAL_RESIZE,
@ -43,7 +48,11 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
CloudTerm.write = write;
function show(callback) {
var socket = CloudCmd.Socket;
var options = {
onUpdate: onResize,
},
socket = CloudCmd.Socket;
if (!Loading) {
Images.showLoad({top:true});
@ -91,13 +100,7 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
Terminal.brokenBold = true;
Util.exec(callback);
}, {
onUpdate: function() {
var size = getSize();
Term.resize(size.cols, size.rows);
Term.emit('resize', size);
}
});
}, options);
}
}
@ -142,6 +145,18 @@ var CloudCmd, Util, DOM, CloudFunc, Terminal;
return size;
}
function onResize() {
var size = getSize(),
cols = size.cols,
rows = size.rows;
if (Size.cols !== cols || Size.rows !== rows) {
Size = size;
Term.resize(size.cols, size.rows);
Term.emit('resize', size);
}
}
function load(pCallBack) {
var dir = CloudCmd.LIBDIRCLIENT + 'terminal/',