Moved out function resize_terminal

static
Sheng 2019-05-17 21:27:25 +08:00
parent 99ed01ca84
commit b58be46918
1 changed files with 9 additions and 6 deletions

View File

@ -66,6 +66,7 @@ jQuery(function($){
} }
} }
function restore_items(names) { function restore_items(names) {
var i, name, value; var i, name, value;
@ -77,9 +78,9 @@ jQuery(function($){
} }
} }
} }
restore_items(fields); restore_items(fields);
function parse_xterm_style() { function parse_xterm_style() {
var text = $('.xterm-helpers style').text(); var text = $('.xterm-helpers style').text();
var arr = text.split('xterm-normal-char{width:'); var arr = text.split('xterm-normal-char{width:');
@ -94,11 +95,13 @@ jQuery(function($){
style.height = term._core.renderer.dimensions.actualCellHeight; style.height = term._core.renderer.dimensions.actualCellHeight;
} }
function toggle_fullscreen(term) { function toggle_fullscreen(term) {
var func = term.toggleFullScreen || term.toggleFullscreen; var func = term.toggleFullScreen || term.toggleFullscreen;
func.call(term, true); func.call(term, true);
} }
function current_geometry(term) { function current_geometry(term) {
if (!style.width || !style.height) { if (!style.width || !style.height) {
try { try {
@ -113,6 +116,11 @@ jQuery(function($){
return {'cols': cols, 'rows': rows}; 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) { function format_geometry(cols, rows) {
return JSON.stringify({'cols': cols, 'rows': 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); 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) { function term_write(text) {
if (term) { if (term) {
term.write(text); term.write(text);