Updated version and diff changes

This commit is contained in:
Nathan Byrd 2022-03-28 18:51:43 -05:00
parent 40a4e306de
commit 44129f3348
2 changed files with 7 additions and 14 deletions

View File

@ -21,16 +21,8 @@ function ANSIEscapeParser(options) {
events.EventEmitter.call(this); events.EventEmitter.call(this);
this.column = 1; this.column = 1;
this.scrollBack = 0;
this.graphicRendition = {}; this.graphicRendition = {};
if(!_.isNil(options?.startRow)) {
this.row = options.startRow;
}
else {
this.row = 1;
}
this.parseState = { this.parseState = {
re : /(?:\x1b\x5b)([?=;0-9]*?)([ABCDHJKfhlmnpsu])/g, // eslint-disable-line no-control-regex re : /(?:\x1b\x5b)([?=;0-9]*?)([ABCDHJKfhlmnpsu])/g, // eslint-disable-line no-control-regex
}; };
@ -42,11 +34,15 @@ function ANSIEscapeParser(options) {
trailingLF : 'default', // default|omit|no|yes, ... trailingLF : 'default', // default|omit|no|yes, ...
}); });
this.mciReplaceChar = miscUtil.valueWithDefault(options.mciReplaceChar, ''); this.mciReplaceChar = miscUtil.valueWithDefault(options.mciReplaceChar, '');
this.termHeight = miscUtil.valueWithDefault(options.termHeight, 25); this.termHeight = miscUtil.valueWithDefault(options.termHeight, 25);
this.termWidth = miscUtil.valueWithDefault(options.termWidth, 80); this.termWidth = miscUtil.valueWithDefault(options.termWidth, 80);
this.trailingLF = miscUtil.valueWithDefault(options.trailingLF, 'default'); this.trailingLF = miscUtil.valueWithDefault(options.trailingLF, 'default');
this.row = Math.min(options?.startRow ?? 1, this.termHeight);
self.moveCursor = function(cols, rows) { self.moveCursor = function(cols, rows) {
self.column += cols; self.column += cols;
self.row += rows; self.row += rows;
@ -75,14 +71,11 @@ function ANSIEscapeParser(options) {
}; };
self.clearScreen = function() { self.clearScreen = function() {
// :TODO: should be doing something with row/column? self.column = 1;
self.row = 1;
self.emit('clear screen'); self.emit('clear screen');
}; };
/*
self.rowUpdated = function() {
self.emit('row update', self.row + self.scrollBack);
};*/
self.positionUpdated = function() { self.positionUpdated = function() {
self.emit('position update', self.row, self.column); self.emit('position update', self.row, self.column);

View File

@ -1,6 +1,6 @@
{ {
"name": "enigma-bbs", "name": "enigma-bbs",
"version": "0.0.14-beta", "version": "0.0.13-beta",
"description": "ENiGMA½ Bulletin Board System", "description": "ENiGMA½ Bulletin Board System",
"author": "Bryan Ashby <bryan@l33t.codes>", "author": "Bryan Ashby <bryan@l33t.codes>",
"license": "BSD-2-Clause", "license": "BSD-2-Clause",