diff --git a/core/fse.js b/core/fse.js index d294f10b..1d9d6dd7 100644 --- a/core/fse.js +++ b/core/fse.js @@ -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; diff --git a/core/servers/content/gopher.js b/core/servers/content/gopher.js index f5ae9cfa..c47efc5c 100644 --- a/core/servers/content/gopher.js +++ b/core/servers/content/gopher.js @@ -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) diff --git a/core/servers/content/nntp.js b/core/servers/content/nntp.js index cbb4d629..7135a585 100644 --- a/core/servers/content/nntp.js +++ b/core/servers/content/nntp.js @@ -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); } } diff --git a/core/string_util.js b/core/string_util.js index 8fab88b8..4f7741ae 100644 --- a/core/string_util.js +++ b/core/string_util.js @@ -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 = '';