Open Inc0n opened 2 years ago
I am not sure if I understand, but vterm should correctly respect ansi colors, e.g.: echo -e "\033[31m Hello World"
is printed as red.
Sorry, it seems that my request isn't entirely very clear. Here is my more lengthy explanation, please go on ahead to the second heading first, for a quick summary.
What I would want for a better integration between org babel and vterm, would be that text-properties of the buffer string to be preserved after extracted from vterm buffer and inserted back into the org file (session).
The problem is org babel removes all text properties, filter these results.
If vterm can, instead of (using your example) echo -e "\033[31m Hello World"
is printed as red, print it as is, e.g. just \033[31m Hello World
. So that so the raw ansi color code is "preserved".
Now buffer-substring will return \033[31m Hello World
instead of Hello World
with red foreground text property, and org babel will not strip away the text property information and once the result is inserted back into the org file, ansi-color-apply-on-region
can be used to translate the string back with text property.
Currently, I have made a custom ob-shell package that integration of shell and org babel, which allows for ansi-colored results output as a result of the ob-shell src block execute, using
ansi-color-for-comint-mode
.Now I am trying the same for vterm, the buffer-substring shows that the substring are fontified with properties, however, org babel strips those properties once the results are inserted.
This lead me back to try to figure out a way to get raw ansi color codes in vterm output.