eclipse-platform / eclipse-platform/eclipse.platform

The default Console copy preserves the ANSI escapes

Aperta
#536 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
165
Fork
174
Merge medio
2g 8h
PR unite (30g)
22

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci l'esempio nella Console predefinita e confronta il comando di copia predefinito con l'output renderizzato. Inizia tracciando il modo in cui LineStyleListener.lineGetStyle influisce sul testo copiato e consulta la discussione collegata sull'ANSI plugin; il lavoro è completo quando sia la copia da tastiera sia quella dal menu contestuale omettono le sequenze di escape ANSI mantenendo il testo visibile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
desktop
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.