commit cce9371649f0c8d9bd69d3aea41b0a45a9766eb4
parent 08f144c4d7787b9e3111551c58335034c8743ca1
Author: Sheng <webmaster0115@gmail.com>
Date: Sat, 26 May 2018 12:28:17 +0800
Use parseFloat for parsing font size
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js
@@ -42,9 +42,9 @@ jQuery(function($){
function parse_xterm_style() {
var text = $('.xterm-helpers style').text();
var arr = text.split('xterm-normal-char{width:');
- style.width = parseInt(arr[1]) + 1;
+ style.width = parseFloat(arr[1]);
arr = text.split('div{height:');
- style.height = parseInt(arr[1]);
+ style.height = parseFloat(arr[1]);
}
@@ -52,7 +52,7 @@ jQuery(function($){
if (!style.width || !style.height) {
parse_xterm_style();
}
- cols = parseInt(window.innerWidth / style.width);
+ cols = parseInt(window.innerWidth / style.width) - 1;
rows = parseInt(window.innerHeight / style.height);
return {'cols': cols, 'rows': rows};
}