First commit of "advanced" MCI formatting via theme.hjson entries allowing mini-formatting langauge to apply
Example: {BN!styleFirstLower} in 'text' property
This commit is contained in:
@@ -11,6 +11,9 @@ const renderSubstr = require('./string_util.js').renderSubstr;
|
||||
const renderStringLength = require('./string_util.js').renderStringLength;
|
||||
const pipeToAnsi = require('./color_codes.js').pipeToAnsi;
|
||||
const stripAllLineFeeds = require('./string_util.js').stripAllLineFeeds;
|
||||
const getPredefinedMCIFormatObject =
|
||||
require('./predefined_mci').getPredefinedMCIFormatObject;
|
||||
const stringFormat = require('./string_format');
|
||||
|
||||
// deps
|
||||
const util = require('util');
|
||||
@@ -153,6 +156,12 @@ TextView.prototype.setText = function (text, redraw) {
|
||||
text = text.toString();
|
||||
}
|
||||
|
||||
const formatObj = getPredefinedMCIFormatObject(this.client, text);
|
||||
if (formatObj) {
|
||||
// expand before converting
|
||||
text = stringFormat(text, formatObj);
|
||||
}
|
||||
|
||||
this.text = pipeToAnsi(stripAllLineFeeds(text), this.client); // expand MCI/etc.
|
||||
if (this.maxLength > 0) {
|
||||
this.text = renderSubstr(this.text, 0, this.maxLength);
|
||||
|
||||
Reference in New Issue
Block a user