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
This commit is contained in:
KLuka 2015-06-12 14:03:37 +02:00
parent 14d44513ff
commit bcac95b9fa
2 changed files with 17 additions and 6 deletions

View file

@ -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.

View file

@ -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