Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

extract default rows / cols #27

Open
wants to merge 1 commit into from

2 participants

@aeosynth

#25 actually missed a couple places w/ embedded constants; this pr extracts those constants as DEFAULT_COLS and DEFAULT_ROWS.

@TooTallNate
Collaborator

Maybe we make it configurable? exports.DEFAULT_ROWS, exports.DEFAULT_COLS? Not sure if that's entirely needed, just thinking out lout.

Generally LGTM though.

@aeosynth

In that case you might as well make everything configurable, and have something like

pty.defaults({
  name: 'xterm-color',
  cols: 80,
  rows: 24,
  cwd: process.env.HOME,
  env: process.env
});
@TooTallNate
Collaborator

Sorry for the delay. I'll merge but this needs a rebase.

@JamesMGreene JamesMGreene referenced this pull request in JamesMGreene/node-partty
Open

Triage existing chjj/pty.js Issues & PRs #1

11 of 50 tasks complete
@JamesMGreene JamesMGreene referenced this pull request from a commit in JamesMGreene/node-partty
@JamesMGreene JamesMGreene Standardized default row and column counts ec88694
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 8, 2012
  1. @aeosynth

    DEFAULT_{COLS,ROWS}

    aeosynth authored
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 6 deletions.
  1. +8 −6 lib/pty.js
View
14 lib/pty.js
@@ -6,6 +6,8 @@
var net = require('net');
var pty = require('../build/Release/pty.node');
+var DEFAULT_COLS = 80;
+var DEFAULT_ROWS = 24;
/**
* Terminal
@@ -49,8 +51,8 @@ function Terminal(file, args, opt) {
file = file || 'sh';
opt = opt || {};
- cols = opt.cols || 80;
- rows = opt.rows || 30;
+ cols = opt.cols || DEFAULT_COLS;
+ rows = opt.rows || DEFAULT_ROWS;
env = clone(opt.env || process.env);
cwd = opt.cwd || process.cwd();
name = opt.name || env.TERM || 'xterm';
@@ -127,8 +129,8 @@ Terminal.open = function(opt) {
};
}
- var cols = opt.cols || 80
- , rows = opt.rows || 30
+ var cols = opt.cols || DEFAULT_COLS
+ , rows = opt.rows || DEFAULT_ROWS
, term;
// open
@@ -262,8 +264,8 @@ Terminal.prototype.__defineGetter__('stderr', function() {
*/
Terminal.prototype.resize = function(cols, rows) {
- cols = cols || 80;
- rows = rows || 24;
+ cols = cols || DEFAULT_COLS;
+ rows = rows || DEFAULT_ROWS;
this.cols = cols;
this.rows = rows;
Something went wrong with that request. Please try again.