Moved out function resize_terminal

This commit is contained in:
Sheng
2019-05-17 21:27:25 +08:00
parent 99ed01ca84
commit b58be46918

View File

@@ -66,6 +66,7 @@ jQuery(function($){
}
}
function restore_items(names) {
var i, name, value;
@@ -77,9 +78,9 @@ jQuery(function($){
}
}
}
restore_items(fields);
function parse_xterm_style() {
var text = $('.xterm-helpers style').text();
var arr = text.split('xterm-normal-char{width:');
@@ -94,11 +95,13 @@ jQuery(function($){
style.height = term._core.renderer.dimensions.actualCellHeight;
}
function toggle_fullscreen(term) {
var func = term.toggleFullScreen || term.toggleFullscreen;
func.call(term, true);
}
function current_geometry(term) {
if (!style.width || !style.height) {
try {
@@ -113,6 +116,11 @@ jQuery(function($){
return {'cols': cols, 'rows': rows};
}
function resize_terminal(term) {
var geometry = current_geometry(term);
term.on_resize(geometry.cols, geometry.rows);
}
function format_geometry(cols, rows) {
return JSON.stringify({'cols': cols, 'rows': rows});
@@ -229,11 +237,6 @@ jQuery(function($){
console.log('The deault encoding of your server is ' + msg.encoding);
}
function resize_terminal(term) {
var geometry = current_geometry(term);
term.on_resize(geometry.cols, geometry.rows);
}
function term_write(text) {
if (term) {
term.write(text);