diff --git a/demo/main.js b/demo/main.js index 58d79e192..9fa5964d2 100644 --- a/demo/main.js +++ b/demo/main.js @@ -91,6 +91,7 @@ function createTerminal() { scrollback: parseInt(optionElements.scrollback.value, 10), tabStopWidth: parseInt(optionElements.tabstopwidth.value, 10) }); + window.term = term; // Expose `term` to window for debugging purposes term.on('resize', function (size) { if (!pid) { return; @@ -105,8 +106,9 @@ function createTerminal() { socketURL = protocol + location.hostname + ((location.port) ? (':' + location.port) : '') + '/terminals/'; term.open(terminalContainer); - term.fit(); term.winptyCompatInit(); + term.fit(); + term.focus(); // fit is called within a setTimeout, cols and rows need this. setTimeout(function () { diff --git a/gulpfile.js b/gulpfile.js index 907529c4d..49d67ed63 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -196,7 +196,7 @@ gulp.task('sorcery-addons', ['browserify-addons'], function () { gulp.task('webpack', ['build'], function() { return gulp.src('demo/main.js') - .pipe(webpack()) + .pipe(webpack(require('./webpack.config.js'))) .pipe(gulp.dest('demo/dist/')); }); diff --git a/package.json b/package.json index 22f60b750..e4bb08c1a 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "build": "gulp build", "prepublish": "npm run build", "coveralls": "gulp coveralls", - "webpack": "webpack" + "webpack": "gulp webpack" }, "dependencies": {} } diff --git a/src/addons/fit/fit.ts b/src/addons/fit/fit.ts index 1f906ee38..14addfdf1 100644 --- a/src/addons/fit/fit.ts +++ b/src/addons/fit/fit.ts @@ -50,6 +50,11 @@ export function fit(term) { }; export function apply(terminalConstructor) { - terminalConstructor.prototype.proposeGeometry = proposeGeometry.bind(this, this); - terminalConstructor.prototype.fit = fit.bind(this, this); + terminalConstructor.prototype.proposeGeometry = function() { + return proposeGeometry(this); + } + + terminalConstructor.prototype.fit = function() { + return fit(this); + } } diff --git a/src/addons/zmodem/zmodem.ts b/src/addons/zmodem/zmodem.ts index 68ce691c1..57bdde3ce 100644 --- a/src/addons/zmodem/zmodem.ts +++ b/src/addons/zmodem/zmodem.ts @@ -27,6 +27,8 @@ * via `detach()` and a re-`attach()`.) */ +let Zmodem; + export function zmodemAttach(term, ws, opts) { if (!opts) opts = {}; @@ -81,7 +83,7 @@ export function zmodemAttach(term, ws, opts) { } export function apply(terminalConstructor) { - let Zmodem = (typeof window == 'object') ? (window).ZModem : {Browser: null}; // Nullify browser for tests + Zmodem = (typeof window == 'object') ? (window).ZModem : {Browser: null}; // Nullify browser for tests terminalConstructor.prototype.zmodemAttach = zmodemAttach.bind(this, this); terminalConstructor.prototype.zmodemBrowser = Zmodem.Browser