curses

Is there a list of ANSI color escape codes somewhere in the standard libraries?

寵の児 提交于 2021-01-27 17:50:35
问题 I write a lot of little helper scripts, and often these print coloured text in the terminal. For the simplicity of their packaging and distribution, I often want these little scripts to be without any dependencies. Hence I'm duplicating data like this a lot in scripts: ansi_colors = { None: '\x1b[0m', # actually black but whatevs 'red': '\x1b[31m', 'green' : '\x1b[32m', ... } Does this data exist anywhere in the core libraries? I dug around and found that curses has some COLOR_* constants,

Make can't find curses.h

倾然丶 夕夏残阳落幕 提交于 2021-01-24 09:13:37
问题 I have this program called samtools (version 1.3) that is used for manipulating the files that you get from DNA sequencing experiments. The downloaded program is contained in a folder. To set the program up I enter that folder in the terminal (on an ubuntu computer). I enter the commando "make". it runs an prints what it does but terminates with the error message: bam_tview_curses.o bam_tview_curses.c bam_tview_curses.c:41:20: fatal error: curses.h: No such file or directory #include <curses

Configure key repeat delay to detect if key is being pressed

有些话、适合烂在心里 提交于 2020-07-15 08:55:49
问题 I am writing a program in C that uses ncurses to check if a key is being pressed. The problem is that there is a key repeat delay. If I for example hold the key 'a' while in the terminal there is a short delay before 'a' gets repeatedly entered. I want to be able to know if it is being pressed from the point where it is actually pressed. How do temporarily change this delay to be equal to 0 while in the terminal? I'm currently using Mac OSX 10.10.5. 回答1: With ncurses (any curses

Configure key repeat delay to detect if key is being pressed

纵饮孤独 提交于 2020-07-15 08:55:06
问题 I am writing a program in C that uses ncurses to check if a key is being pressed. The problem is that there is a key repeat delay. If I for example hold the key 'a' while in the terminal there is a short delay before 'a' gets repeatedly entered. I want to be able to know if it is being pressed from the point where it is actually pressed. How do temporarily change this delay to be equal to 0 while in the terminal? I'm currently using Mac OSX 10.10.5. 回答1: With ncurses (any curses

How to display pre-colored string with curses?

人走茶凉 提交于 2020-05-27 05:09:41
问题 I'm writing a curses program in Python. I'm a beginner of curses but I've used terminal control sequences for colored output. Now there's some code snippets to print inside the window, I'd like them be syntax highlighted, and it's better done with libraries like pygments, which outputs highlighted code with control sequences. Initially I feed pygments output directly to window.addstr() , but it is turned out that the control sequences is escaped and the whole highlighted string is printed on