Ansi support in ConsoleView

Hi,

i have a process which makes use of ANSI (via JLine) and IntelliJ seems to have some problems parsing its output.
This is currently how I create the tool-window:

 
void initToolWindow(@NotNull final Project project,
                    @NotNull final
ToolWindow toolWindow) {

  final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
  
consoleBuilder.addFilter(new ExceptionFilter(GlobalSearchScope.projectScope(project)));

  final
ConsoleView console = consoleBuilder.getConsole();
  final
Content content = toolWindow.getContentManager().getFactory().createContent(console.getComponent(), "", true);

  
toolWindow.getContentManager().addContent(content);
  
toolWindow.setIcon(DefracIcons.DEFRAC);

  
console.attachToProcess(getProcessHandler());
}


Unfortunately I see some output like this:

[info] Loading project /home/joa/Development/defrac-sample-flutterman/default.settings
[info] Set current project to "Flutterman Sample" (/home/joa/Development/defrac-sample-flutterman)
null   null            >


In fact there are some square characters, not shown in the browser. The escape sequence contains \b characters as well.
In general, there is no problem if I run the app in a normal terminal or even the built-in terminal view. Also colors are not present.
The process handler is created via KillableColoredProcessHandler.create(cmdLine)

Is there a way to use the actual Terminal implementation IntelliJ is using? And if not, is there an option for me to filter the escape sequence?
I tried with addFilter but as far as I understand the API, I am only able to annotate the given input.


Thanks,
Joa

Please sign in to leave a comment.