When coding in general I make liberal use of escape sequences for colour and cursor movement.
Some languages need initialisation steps to make this happen, like in python os.system('')
needs to be called before printing escape sequences.
In Java, printing sequences appears limited. In the IDE, only colour sequences (ending with m) work correctly. Other sequences do not work. Colour does not work in cmd-hosted console.
Example code:
public class Main {
public static void main(String[] args) {
System.out.print("Start b");
System.out.print("\033[s\nreplace b with h\033[u\bh\033[38;2;0;255;0mgreen text\033[0m");
}
}
Expected behaviour: ("green text" is bright green)
Start hgreen text
replace b with h
console:
Start b←[s
replace b with h←[h←[38;2;0;255;0mgreen text←[0m
IDE: ("green text is bright green")
Start b
replace b with hgreen text
Is there something like the python os.system call to enable a more 'cooked' console output, or is there some sort of buffered write operation I have to do in order for these sequences to behave correctly?