@@ -29,13 +29,9 @@ requirejs([
2929 var common_config = new configmod . ConfigSection ( 'common' , common_options ) ;
3030 common_config . load ( ) ;
3131
32+ // This makes the 'logout' button in the top right work.
3233 var login_widget = new loginwidget . LoginWidget ( 'span#login_widget' , common_options ) ;
3334
34- // Test size: 25x80
35- var termRowHeight = function ( ) { return 1.00 * $ ( "#dummy-screen" ) [ 0 ] . offsetHeight / 25 ; } ;
36- // 1.02 here arrived at by trial and error to make the spacing look right
37- var termColWidth = function ( ) { return 1.02 * $ ( "#dummy-screen-rows" ) [ 0 ] . offsetWidth / 80 ; } ;
38-
3935 var base_url = utils . get_body_data ( 'baseUrl' ) . replace ( / \/ ? $ / , '/' ) ;
4036 var ws_path = utils . get_body_data ( 'wsPath' ) ;
4137 var ws_url = utils . get_body_data ( 'wsUrl' ) ;
@@ -45,31 +41,19 @@ requirejs([
4541 }
4642 ws_url = ws_url + base_url + ws_path ;
4743
48- var header = $ ( "#header" ) [ 0 ] ;
49-
50- function calculate_size ( ) {
51- var height = $ ( window ) . height ( ) - header . offsetHeight ;
52- var width = $ ( '#terminado-container' ) . width ( ) ;
53- var rows = Math . min ( 1000 , Math . max ( 20 , Math . floor ( height / termRowHeight ( ) ) - 1 ) ) ;
54- var cols = Math . min ( 1000 , Math . max ( 40 , Math . floor ( width / termColWidth ( ) ) - 1 ) ) ;
55- console . log ( "resize to :" , rows , 'rows by ' , cols , 'columns' ) ;
56- return { rows : rows , cols : cols } ;
57- }
58-
5944 page . show_header ( ) ;
6045
61- var size = calculate_size ( ) ;
62- var terminal = terminado . make_terminal ( $ ( "#terminado-container" ) [ 0 ] , size , ws_url ) ;
46+ var terminal = terminado . make_terminal ( $ ( "#terminado-container" ) [ 0 ] , ws_url ) ;
6347
6448 page . show_site ( ) ;
6549
6650 utils . load_extensions_from_config ( config ) ;
6751 utils . load_extensions_from_config ( common_config ) ;
6852
69- window . onresize = function ( ) {
70- var geom = calculate_size ( ) ;
71- terminal . term . resize ( geom . cols , geom . rows ) ;
72- terminal . socket . send ( JSON . stringify ( [ "set_size" , geom . rows , geom . cols ,
53+ window . onresize = function ( ) {
54+ terminal . term . fit ( ) ;
55+ // send the new size to the server so that it can trigger a resize in the running process.
56+ terminal . socket . send ( JSON . stringify ( [ "set_size" , terminal . term . rows , terminal . term . cols ,
7357 $ ( window ) . height ( ) , $ ( window ) . width ( ) ] ) ) ;
7458 } ;
7559
0 commit comments