ansi-escape

Can Terminal.app be made to respect ANSI escape codes?

你说的曾经没有我的故事 提交于 2019-12-02 20:30:34
I notice that with the TERM environment variable set to either xterm or xterm-256color that Mac OS X’s Terminal.app utility respects most ANSI escape codes, as least when those escape codes pertain to changing text color. For example: echo -e "\033[0;31mERROR:\033[0m It worked" Produces: However, I’m more interested in the cursor location manipulation functionality afforded by ANSI escape codes. Unfortunately, that type of code doesn’t seem to work too well in Terminal.app, from what I’ve been able to gather. For example, what I want to do is something like this: echo -e "\033[sHello world\033

Determining escape sequences for cursor keys canonically

馋奶兔 提交于 2019-12-02 12:02:13
问题 I'd like to react on cursor keys; for this I want to find out the escape sequences the current terminal is using in a canonical way. Most solutions just have the strings "\e[A" etc. in the source code. I understand that this is not portable in case the target system uses a different escape sequence. I tried using tput to get the proper escape sequence but tput kcud1 returns a different escape sequence than what is used for the down arrow key: It returns "\eOB" but the key results in "\e[B" .

Determining escape sequences for cursor keys canonically

耗尽温柔 提交于 2019-12-02 06:55:38
I'd like to react on cursor keys; for this I want to find out the escape sequences the current terminal is using in a canonical way. Most solutions just have the strings "\e[A" etc. in the source code. I understand that this is not portable in case the target system uses a different escape sequence. I tried using tput to get the proper escape sequence but tput kcud1 returns a different escape sequence than what is used for the down arrow key: It returns "\eOB" but the key results in "\e[B" . But no capname given to tput results in this string; the best I can manage is tput cud which returns "

How do you enable powershell to interpret ansi color codes when using get-content to echo to the screen?

…衆ロ難τιáo~ 提交于 2019-12-01 08:18:25
I have a log file that contains ansi color codes around various text. I'm echoing it to the console using the powershell language command: get-content logfile.log -wait so I can see the latest log changes. However, all the ansi color codes show up as text characters like: Esc[90mEsc[39m How do you get them intepreted as color codes in the powershell window? Not being very familiar with the powershell language yet, is there a powershell command or encoding option to handle this? I've read various powershell docs but haven't found anything in them re these ansi codes. You can translate the ANSI

python regex escape characters

北城以北 提交于 2019-12-01 07:59:39
问题 We have: >>> str 'exit\r\ndrwxr-xr-x 2 root root 0 Jan 1 2000 \x1b[1;34mbin\x1b[0m\r\ndrwxr-xr-x 3 root root 0 Jan 1 2000 \x1b[1;34mlib\x1b[0m\r\ndrwxr-xr-x 10 root root 0 Jan 1 1970 \x1b[1;34mlocal\x1b[0m\r\ndrwxr-xr-x 2 root root 0 Jan 1 2000 \x1b[1;34msbin\x1b[0m\r\ndrwxr-xr-x 5 root root 0 Jan 1 2000 \x1b[1;34mshare\x1b[0m\r\n# exit\r\n' >>> print str exit drwxr-xr-x 2 root root 0 Jan 1 2000 bin drwxr-xr-x 3 root root 0 Jan 1 2000 lib drwxr-xr-x 10 root root 0 Jan 1 1970 local drwxr-xr-x

How do you enable powershell to interpret ansi color codes when using get-content to echo to the screen?

折月煮酒 提交于 2019-12-01 06:33:25
问题 I have a log file that contains ansi color codes around various text. I'm echoing it to the console using the powershell language command: get-content logfile.log -wait so I can see the latest log changes. However, all the ansi color codes show up as text characters like: Esc[90mEsc[39m How do you get them intepreted as color codes in the powershell window? Not being very familiar with the powershell language yet, is there a powershell command or encoding option to handle this? I've read

How to use ANSI escape sequences with CSCRIPT on Windows 10?

醉酒当歌 提交于 2019-12-01 05:12:10
I'm trying to use the new VT100 ANSI escape sequence capabilities available in the Windows 10 console with CSCRIPT (JScript). But I cannot get it to work. Here is a really simple JScript script: test.js WScript.Echo('\x1B[7mReverse\x1B[0m Normal'); WScript.stdout.WriteLine('\x1B[7mReverse\x1B[0m Normal'); I've done a number of tests, and the escape sequences output by CSCRIPT are impotent when written directly to the screen, and only work if written to a file first and then TYPEed, or else captured by FOR /F and ECHOed. I have two questions: 1) Why doesn't the direct write to the console work

How to use ANSI escape sequences with CSCRIPT on Windows 10?

可紊 提交于 2019-12-01 02:09:36
问题 I'm trying to use the new VT100 ANSI escape sequence capabilities available in the Windows 10 console with CSCRIPT (JScript). But I cannot get it to work. Here is a really simple JScript script: test.js WScript.Echo('\x1B[7mReverse\x1B[0m Normal'); WScript.stdout.WriteLine('\x1B[7mReverse\x1B[0m Normal'); I've done a number of tests, and the escape sequences output by CSCRIPT are impotent when written directly to the screen, and only work if written to a file first and then TYPEed, or else

Is it possible to display text in a console with a strike-through effect?

天大地大妈咪最大 提交于 2019-11-30 18:37:45
I have already looked into ANSI escape codes, but it looks like only underlining is supported. Do I miss something or is there another option? If it is not possible, is there something equivalent in the meaning of "this is deprecated"? According to the ECMA-48 standard for terminals, SGR (Select Graphic Rendition) code number 9 is supposed to enable crossed-out text. However, the ANSI escape code wikipedia page says that it's not widely supported, and I'm not aware of any that do. I'd suspect that's because DEC's VTxxx series didn't support it . An alternative solution for applications written

Java framework for reading / writing ANSI escape-sequenced character streams

一曲冷凌霜 提交于 2019-11-30 15:07:00
Reading ANSI escape sequences is nitty gritty and very easy to get wrong. I am after a library that includes an abstraction for reading escaped sequences preferrably as instances of some nice type. It would be nice if the library offered strongly types rather than everything is a strong and good luck do the stuff yourself. Any pointers to a foss library would be appreciated. A similar question A library to convert ANSI escapes (terminal formatting/color codes) to HTML which seems to have a similar motivation also remains unanswered. c00kiemon5ter You may want to take a look at Jansi. Here is