ansi-escape

How curses preserves screen contents?

假如想象 提交于 2019-12-12 12:49:47
问题 When you start the (n)curses program, it will remove the scroll bar from your terminal emulator, clear the screen, the scroll log (history) will also disappear. When you exit the program, the screen contents reappears, the scroll bar returns, and the scroll buffer returns. How ncurses does it? I have studied all ANSI escape codes, I cannot see anything that can do such things. What is the technology behind this? 回答1: This is discussed at length in the xterm FAQ Why doesn't the screen clear

Support for ANSI escape sequence cursor moving

℡╲_俬逩灬. 提交于 2019-12-12 02:13:55
问题 I'm making a simple ASCII animation, and I need the ability to place the cursor at an arbitrary point in the console screen. While searching, I found this blog that shows this can be achieved by doing: (print (str (char 27) "[2J")) ; clear screen (print (str (char 27) "[;H")) ; move cursor to the top left corner of the screen , which uses ANSI escape sequences. The first line works as expected, but unfortunately, I haven't been able to find a console that allows for the second line to move

What is the ANSI escape code sequence “ESC[>c”?

风流意气都作罢 提交于 2019-12-11 13:05:44
问题 After typing "vi [FILENAME]" in the bash I get the following result: .... \r\"gu1.txt\" 16L, 87C ESC[>cESC[1;1H 111\r\n1112 ..... The first text marked in the this row is the file name following the number of lines and columns of the vi result. The second text includes two escape sequences which I don't understand their meaning : ESC[>c and ESC[1;1H . The last text includes the text shown as a result of the vi, i.e. the content of the file. Can you please explain what is the ANSI escape code

Is it possible to enable VT100/ANSI escape codes from PHP 5 in Windows

独自空忆成欢 提交于 2019-12-10 19:23:24
问题 I'm in the process of upgrading an old PHP 5 app to PHP 7. I'm using Codeception for unit testing because it has nice colour output, making it easy to see if all the tests have passed or not. Things I have tried: Upgrade to PHP 7: the app crashes Run Codeception with no special flags: ANSI escape codes are printed to screen making the output hard to read Run Codeception with the --no-colors flag: output is a single colour taking longer to recognise a 100% passing run, or which tests have

ansi escape sequences not working in windows cmd prompt

耗尽温柔 提交于 2019-12-10 15:56:18
问题 I tried the ANSI escape sequences like \033[K \033[%dd \033[%dG etc, in AIX. When I used telnet in windows, it didn't work. The same is working fine using putty. I don't want to use NCURSES, but printf s. Any idea will be appreciated. 回答1: Windows's command-prompt is not ANSI. It has its own set of commands to use, but they are not escape sequences. You can, however, use ANSI.SYS to gain access to similar functionality. Read more here. 来源: https://stackoverflow.com/questions/6532295/ansi

Detect ANSI-compatible console from Windows batch file?

懵懂的女人 提交于 2019-12-10 14:47:32
问题 Windows 10 console host, conhost.exe , has native support for ANSI escape sequences, older versions do not. How can one detect the presence or absence of console ANSI support from a batch file? Is it possible to call GetConsoleMode or other Windows API calls directly from a batch file? 回答1: The answer to your last question is: Yes, with the aid of PowerShell code. This Batch file do what you requested: @echo off setlocal set /A STD_OUTPUT_HANDLE=-11 set /A ENABLE_PROCESSED_OUTPUT=1, ENABLE

How do I determine size of ANSI terminal?

元气小坏坏 提交于 2019-12-10 13:26:12
问题 Standard input and output are connected to a terminal that implements ANSI escape sequences, but is of unknown dimensions. I need to know how big the terminal so to facilitate drawing a full-screen text UI on it. How can I get the size? The correct size is not loaded into environment variables. I cannot use TIOCGETS; the the call would return success but the values are not correct -- the kernel doesn't know the size either. There are lots and lots of answers searching stackoverflow, but they

Bash printing color codes literally and not in actual color

亡梦爱人 提交于 2019-12-10 12:53:13
问题 For some reason my shell script stopped printing my menu in color and is actually printing the literal color code instead. Did I somehow escape the color coding? Script #!/bin/bash function showEnvironments { echo -e "\e[38;5;81m" echo -e " SELECT ENVIRONMENT " echo -e "[1] - QA" echo -e "[2] - PROD" echo -e "\e[0m" } showEnvironments Output \e[38;5;81m SELECT ENVIRONMENT [1] - Staging [2] - QA \e[0m I am using iTerm on Mac OSX and the TERM environment variable is set to xterm-256color . 回答1:

Are there Ansi escape sequences for superscript and subscript?

99封情书 提交于 2019-12-10 08:01:42
问题 I'm playing around with ANSI escape sequences, e.g. echo -e "\e[91mHello\e[m" on a Linux console to display colored text. Now I try to use superscript and subscript output like a=b² . I read here and here about: Partial Line Down (subscript) and Partial Line Up (superscript) but I'm not sure about the exact syntax and even which terminal client might supports this. Any suggestions about this? 回答1: Possibly some commercial product supports it, but it's not supported by any terminal emulator

Is there a simple way to get rid of junk values that come when you SSH using Python's Paramiko library and fetch output from CLI of a remote machine?

≯℡__Kan透↙ 提交于 2019-12-08 13:56:31
I am using Python's Paramiko library to SSH a remote machine and fetch some output from command-line. I see a lot of junk printing along with the actual output. How to get rid of this? chan1.send("ls\n") output = chan1.recv(1024).decode("utf-8") print(output) [u'Last login: Wed Oct 21 18:08:53 2015 from 172.16.200.77\r', u'\x1b[2J\x1b[1;1H[local]cli@BENU>enable', u'[local]cli@BENU#Configure', I want to eliminate, [2J\x1b[1;1H and u from the output. They are junk. It's not a junk. These are ANSI escape codes that are normally interpreted by a terminal client to pretty print the output. If the