add escape function for tag text.
This commit is contained in:
parent
737c88d7e5
commit
4bc910bd5b
|
@ -37,6 +37,11 @@ blessed.helpers = {
|
|||
tryRead: blessed.tput.tryRead
|
||||
};
|
||||
|
||||
Object.keys(widget.helpers).forEach(function(key) {
|
||||
blessed.helpers[key] = widget.helpers[key];
|
||||
blessed[key] = widget.helpers[key];
|
||||
});
|
||||
|
||||
/**
|
||||
* Expose
|
||||
*/
|
||||
|
|
|
@ -6368,6 +6368,19 @@ var wideChars = new RegExp('(['
|
|||
+ '\\uffe8-\\uffee'
|
||||
+ '])', 'g');
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
var helpers = {};
|
||||
|
||||
// Escape text for tag-enabled elements.
|
||||
helpers.escape = function(text) {
|
||||
return text.replace(/[{}]/g, function(ch) {
|
||||
return ch === '{' ? '{open}' : '{close}';
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose
|
||||
*/
|
||||
|
@ -6400,3 +6413,5 @@ exports.Loading = exports.loading = Loading;
|
|||
exports.Listbar = exports.listbar = Listbar;
|
||||
exports.DirManager = exports.dirmanager = DirManager;
|
||||
exports.Passbox = exports.passbox = Passbox;
|
||||
|
||||
exports.helpers = helpers;
|
||||
|
|
|
@ -15,6 +15,7 @@ var box = blessed.box({
|
|||
wrap: false,
|
||||
tags: true,
|
||||
content: fs.readFileSync(__filename, 'utf8')
|
||||
// content: '{red-bg}' + blessed.escape('{{{{{}{bold}x{/bold}}') + '{/red-bg}'
|
||||
});
|
||||
|
||||
box.focus();
|
||||
|
|
Loading…
Reference in New Issue