From 7628864058bf0fcd27fb61eb6b2eb3a95a717ae9 Mon Sep 17 00:00:00 2001 From: Antonis Kalipetis Date: Fri, 18 Nov 2016 12:48:49 +0200 Subject: [PATCH] Fix race conditions when initially resizing terminal Race conditions could happen if the Terminal container did not have the correct size during initialization. Signed-off-by: Antonis Kalipetis --- www/assets/app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/www/assets/app.js b/www/assets/app.js index a7a27dd..5f2300d 100644 --- a/www/assets/app.js +++ b/www/assets/app.js @@ -204,9 +204,11 @@ }); term.open(terminalContainer); - term.fit(); - - $scope.resize(term.proposeGeometry()); + + // Set geometry during the next tick, to avoid race conditions. + setTimeout(function() { + $scope.resize(term.proposeGeometry()); + }, 4); term.on('data', function(d) { $scope.socket.emit('terminal in', instance.name, d);