cleanControlCodes -> stripAnsiControlCodes

This commit is contained in:
Bryan Ashby 2018-12-17 22:08:59 -07:00
parent eeaeef9a8c
commit f4088303ca
4 changed files with 9 additions and 11 deletions

View File

@ -18,7 +18,7 @@ const {
MessageAreaConfTempSwitcher
} = require('./mod_mixins.js');
const {
isAnsi, cleanControlCodes,
isAnsi, stripAnsiControlCodes,
insert
} = require('./string_util.js');
const Config = require('./config.js').get;
@ -400,7 +400,7 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul
}
);
} else {
bodyMessageView.setText(cleanControlCodes(msg));
bodyMessageView.setText(stripAnsiControlCodes(msg));
}
}
}
@ -733,7 +733,7 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul
var bodyMessageView = self.viewControllers.body.getView(MciViewIds.body.message);
if(bodyMessageView && _.has(self, 'message.message')) {
//self.setBodyMessageViewText();
bodyMessageView.setText(cleanControlCodes(self.message.message));
bodyMessageView.setText(stripAnsiControlCodes(self.message.message));
}
}
break;

View File

@ -8,7 +8,7 @@ const Config = require('../../config.js').get;
const {
splitTextAtTerms,
isAnsi,
cleanControlCodes
stripAnsiControlCodes
} = require('../../string_util.js');
const {
getMessageConferenceByTag,
@ -218,7 +218,7 @@ exports.getModule = class GopherModule extends ServerModule {
);
} else {
const cleaned = stripMciColorCodes(
cleanControlCodes(body, { all : true } )
stripAnsiControlCodes(body, { all : true } )
);
const prepped =
splitTextAtTerms(cleaned)

View File

@ -16,7 +16,7 @@ const Message = require('../../message.js');
const FTNAddress = require('../../ftn_address.js');
const {
isAnsi,
cleanControlCodes,
stripAnsiControlCodes,
splitTextAtTerms,
} = require('../../string_util.js');
const AnsiPrep = require('../../ansi_prep.js');
@ -655,7 +655,7 @@ class NNTPServer extends NNTPServerBase {
}
);
} else {
message.preparedBody = stripMciColorCodes(cleanControlCodes(message.message, { all : true }));
message.preparedBody = stripMciColorCodes(stripAnsiControlCodes(message.message, { all : true }));
return cb(null);
}
}

View File

@ -23,7 +23,7 @@ exports.formatByteSizeAbbr = formatByteSizeAbbr;
exports.formatByteSize = formatByteSize;
exports.formatCountAbbr = formatCountAbbr;
exports.formatCount = formatCount;
exports.cleanControlCodes = cleanControlCodes;
exports.stripAnsiControlCodes = stripAnsiControlCodes;
exports.isAnsi = isAnsi;
exports.isAnsiLine = isAnsiLine;
exports.isFormattedLine = isFormattedLine;
@ -218,8 +218,6 @@ function stringToNullTermBuffer(s, options = { encoding : 'utf8', maxBufLen : -1
}
const PIPE_REGEXP = /(\|[A-Z\d]{2})/g;
//const ANSI_REGEXP = /[\u001b\u009b][[()#;?]*([0-9]{1,4}(?:;[0-9]{0,4})*)?([0-9A-ORZcf-npqrsuy=><])/g;
//const ANSI_OR_PIPE_REGEXP = new RegExp(PIPE_REGEXP.source + '|' + ANSI_REGEXP.source, 'g');
const ANSI_OR_PIPE_REGEXP = new RegExp(PIPE_REGEXP.source + '|' + ANSI.getFullMatchRegExp().source, 'g');
//
@ -357,7 +355,7 @@ const ANSI_OPCODES_ALLOWED_CLEAN = [
'm', // color
];
function cleanControlCodes(input, options) {
function stripAnsiControlCodes(input, options) {
let m;
let pos;
let cleaned = '';