eclipse-platform / eclipse-platform/eclipse.platform

The default Console copy preserves the ANSI escapes

Open
#536 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
165
Forks
174
Avg merge
2d 8h
Merged PRs (30d)
22

Description

Outputs some text with ANSI escape sequences to the console
For example with:
```
System.out.println("Hello \033[91mRED\033[m \033[101mRED\033[m world!");
```
The resulting console output is colored (red foreground / background), and the escape sequences (from `\033` to `m`) are not visible.
But they are there (as `LineStyleListener.lineGetStyle` can't change the text, only add styles).

So the default copy command will take the text "as is", including the escape sequences.

Seeing those ANSI codes is only useful for debugging, and (probably) most users expect the copy to be WYSIWYG (so they don't expect to see the codes).

---

This is also the feedback I got (years ago) for the ANSI plugin (before it became part of Eclipse).

The plugin was doing something about it, but did it by "hijacking" the hotkey of the copy command.
So Ctrl+C (Command+C on MacOS) did a copy without escape codes.
But context menu - Copy did a copy with escapes.

See the thread during the integration into Eclipse:
https://github.com/eclipse-platform/eclipse.platform.debug/issues/57

At the time I've tried replacing the Copy command properly, and also tried "tinkering" with the option menu.
But I didn't manage to make things work well enough.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.