Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blessed xterm fixes #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions blessed-xterm.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,21 @@
*/

/* external requirements */
const clone = require("clone")
const blessed = require("blessed")
const Pty = require("node-pty")
const jsdom = require("jsdom")

/* CRUEL HACK: xterm.js accesses the global "window", so we have to emulate this environment */
var dom = new jsdom.JSDOM()
global.window = dom.window
global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0)
var document = dom.window.document
var document;
if (typeof window !== 'undefined') {
window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
document = window.document;
} else {
var dom = new jsdom.JSDOM();
global.window = dom.window;
global.window.requestAnimationFrame = (cb) => setTimeout(cb, 0);
document = dom.window.document;
}

/* load xterm.js */
const XTermJS = require("xterm")
Expand All @@ -41,9 +46,6 @@ const XTermJS = require("xterm")
class XTerm extends blessed.Box {
/* construct the API class */
constructor (options = {}) {
/* clone options or all widget instances will show
at least the same style, etc. */
options = clone(options)

/* disable the special "scrollable" feature of Blessed's Element
which would use a ScrolledBox instead of a Box under the surface */
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
},
"dependencies" : {
"babel-runtime": "~6.26.0",
"clone": "~2.1.1",
"blessed": "~0.1.81",
"jsdom": "~11.5.1",
"xterm": "~2.8.1",
Expand Down