From bcac95b9faad0b2576193056aac0f96d909de463 Mon Sep 17 00:00:00 2001 From: KLuka Date: Fri, 12 Jun 2015 14:03:37 +0200 Subject: [PATCH] Issue #63, #315: only one line is displayed * Changed detection for when terminal is embedded in another element. Now we allow one pixel difference between calculated terminal width and body width. This needs to be done because some browsers report wrong width in offsetWidth property, when browser zoom is in use. * Updated README --- README.md | 11 +++++++++-- shellinabox/vt100.jspp | 12 ++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ab1bb1d..77ce54d 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ shellinabox =========== +[![Build Status](https://drone.io/github.com/shellinabox/shellinabox/status.png)](https://drone.io/github.com/shellinabox/shellinabox/latest) [![Join the chat at https://gitter.im/shellinabox/shellinabox](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/shellinabox/shellinabox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://drone.io/github.com/shellinabox/shellinabox/status.png)](https://drone.io/github.com/shellinabox/shellinabox/latest) This is unofficial fork of project **Shell In A Box**. Fork was created because original project is not maintained anymore and we cannot contact original @@ -96,5 +96,12 @@ Issues All reported issues were imported from [Google Code Project Issues](https://code.google.com/p/shellinabox/issues/list). You can report new issues here, but first please try to reproduce them with package -created from our sources. +created from our sources. In new issue report please include following things: +* Name and version of your operating system +* Name and version of your browser +* Version of shellinabox +* Steps to reproduce the problem + +Also feel free to post any questions or comments in [shellianbox chat room](https://gitter.im/shellinabox/shellinabox) +on Gitter. diff --git a/shellinabox/vt100.jspp b/shellinabox/vt100.jspp index 9f8fd8f..e06efca 100755 --- a/shellinabox/vt100.jspp +++ b/shellinabox/vt100.jspp @@ -987,12 +987,16 @@ VT100.prototype.initializeElements = function(container) { x += parent.offsetLeft; y += parent.offsetTop; } + // When zoom functionality is used, some browsers report container offsetWidth + // wrong by one pixel. This is the reason why widthDiff can be 0 or -1 pixel, + // and in this case variable isEmbedded is not set to true. + var widthDiff = ((window.innerWidth || + document.documentElement.clientWidth || + document.body.clientWidth) - marginRight) + - (x + this.container.offsetWidth); this.isEmbedded = marginTop != y || marginLeft != x || - (window.innerWidth || - document.documentElement.clientWidth || - document.body.clientWidth) - - marginRight != x + this.container.offsetWidth; + (widthDiff != 0 && widthDiff != -1); if (!this.isEmbedded) { // Some browsers generate resize events when the terminal is first // shown. Disable showing the size indicator until a little bit after