Skip to content

Commit

Permalink
allow to use ansi option in less
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Aug 3, 2021
1 parent 4f9dc83 commit 497c963
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* use dash `-` as input file to read from STDIN in `from-ansi` executable
* improve auth error message
* add "enter" typing animation with prefix prompt
* allow to render ansi in less correctly (using `ansi` option)
### Bugfix
* fix rest of the extension files in NodeJS (regression since 2.22.0)
* fix inheritance of attributes (including styles) and classes in nested formatting
Expand Down
11 changes: 10 additions & 1 deletion js/less.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,15 @@
to_print.push('~');
}
}
term.echo(to_print.join('\n'));
var finalize;
if (options.ansi) {
finalize = function(div) {
div.addClass('ansi');
};
}
term.echo(to_print.join('\n'), {
finalize: finalize
});
if (term.find('.terminal-output').is(':empty')) {
// sometimes the output is not flushed not idea why
// TODO: investigate
Expand Down Expand Up @@ -536,6 +544,7 @@
$.fn.less = function(text, options) {
var settings = $.extend({
onExit: $.noop,
ansi: false,
formatters: false
}, options);
if (!(this instanceof $.fn.init && this.terminal)) {
Expand Down

0 comments on commit 497c963

Please sign in to comment.