Yet more FSE color/style improvements

This commit is contained in:
Bryan Ashby 2020-12-31 15:35:44 -07:00
parent 6abd166d22
commit 14b1b2b145
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
2 changed files with 9 additions and 7 deletions

View File

@ -126,7 +126,7 @@ function renegadeToAnsi(s, client) {
// //
// Converts various control codes popular in BBS packages // Converts various control codes popular in BBS packages
// to ANSI escape sequences. Additionaly supports ENiGMA style // to ANSI escape sequences. Additionally supports ENiGMA style
// MCI codes. // MCI codes.
// //
// Supported control code formats: // Supported control code formats:
@ -134,16 +134,17 @@ function renegadeToAnsi(s, client) {
// * PCBoard : @X## where the first number/char is BG color, and second is FG // * PCBoard : @X## where the first number/char is BG color, and second is FG
// * WildCat! : @##@ the same as PCBoard without the X prefix, but with a @ suffix // * WildCat! : @##@ the same as PCBoard without the X prefix, but with a @ suffix
// * WWIV : ^# // * WWIV : ^#
// * CNET Y-Style : 0x19## where ## is a specific set of codes -- this is the older format // * CNET Control-Y: AKA Y-Style -- 0x19## where ## is a specific set of codes (older format)
// * CNET Q-style : 0x11##} where ## is a specific set of codes -- this is the newer format // * CNET Control-Q: AKA Q-style -- 0x11##} where ## is a specific set of codes (newer format)
// //
// TODO: Add Synchronet and Celerity format support // TODO: Add Synchronet and Celerity format support
// //
// Resources: // Resources:
// * http://wiki.synchro.net/custom:colors // * http://wiki.synchro.net/custom:colors
// * https://archive.org/stream/C-Net_Pro_3.0_1994_Perspective_Software/C-Net_Pro_3.0_1994_Perspective_Software_djvu.txt
// //
function controlCodesToAnsi(s, client) { function controlCodesToAnsi(s, client) {
const RE = /(\|([A-Z0-9]{2})|\|)|(@X([0-9A-F]{2}))|(@([0-9A-F]{2})@)|(\x03[0-9]|\x03)|(\x19(c[0-9a-f]|z[0-7]|n1|f1)|\x19)|(\x11(c[0-9a-f]|z[0-7]|n1|f1)}|\x11)/g; // eslint-disable-line no-control-regex const RE = /(\|([A-Z0-9]{2})|\|)|(@X([0-9A-F]{2}))|(@([0-9A-F]{2})@)|(\x03[0-9]|\x03)|(\x19(c[0-9a-f]|z[0-7]|n1|f1|q1)|\x19)|(\x11(c[0-9a-f]|z[0-7]|n1|f1|q1)}|\x11)/g; // eslint-disable-line no-control-regex
let m; let m;
let result = ''; let result = '';

View File

@ -455,11 +455,12 @@ exports.FullScreenEditorModule = exports.getModule = class FullScreenEditorModul
// //
if (this.menuConfig.config.quoteStyleLevel1) { if (this.menuConfig.config.quoteStyleLevel1) {
// can be a single style to cover 'XX> TEXT' or an array to cover 'XX', '>', and TEXT // can be a single style to cover 'XX> TEXT' or an array to cover 'XX', '>', and TEXT
// Non-standard (as for BBSes) single > TEXT, omitting space before XX, etc. are allowed
const styleL1 = styleToArray(this.menuConfig.config.quoteStyleLevel1, 3); const styleL1 = styleToArray(this.menuConfig.config.quoteStyleLevel1, 3);
const QuoteRegex = /^ ([A-Za-z0-9]{1,2})>([ ]+)([^\r\n]*\r?\n)/gm; const QuoteRegex = /^([ ]?)([!-~]{0,2})>([ ]*)([^\r\n]*\r?\n)/gm;
msg = msg.replace(QuoteRegex, (m, initials, spc, text) => { msg = msg.replace(QuoteRegex, (m, spc1, initials, spc2, text) => {
return ` ${styleL1[0]}${initials}${styleL1[1]}>${spc}${styleL1[2]}${text}${bodyMessageView.styleSGR1}`; return `${spc1}${styleL1[0]}${initials}${styleL1[1]}>${spc2}${styleL1[2]}${text}${bodyMessageView.styleSGR1}`;
}); });
} }