terminfo

Terminal color using terminfo?

半腔热情 提交于 2021-01-23 06:36:05
问题 I am writing a C++ class permitting the usage of color in terminal. I want it works on every terminal : printing with true color (24 bits) on terminals that supports it, with 256 color (6x6x6) on terminals that supports it, else with the basic 16 colors. I wrote once C functions using termcap, and I thought using it in this case. However, the man page says : The termcap database is an obsolete facility for describing the capabilities of character-cell terminals and printers. It is retained

How do I determine if a terminal is color-capable?

99封情书 提交于 2020-01-20 01:35:45
问题 I would like to change a program to automatically detect whether a terminal is color-capable or not, so when I run said program from within a non-color capable terminal (say M-x shell in (X)Emacs), color is automatically turned off. I don't want to hardcode the program to detect TERM={emacs,dumb}. I am thinking that termcap/terminfo should be able to help with this, but so far I've only managed to cobble together this (n)curses-using snippet of code, which fails badly when it can't find the

How do I determine if a terminal is color-capable?

旧时模样 提交于 2020-01-20 01:35:01
问题 I would like to change a program to automatically detect whether a terminal is color-capable or not, so when I run said program from within a non-color capable terminal (say M-x shell in (X)Emacs), color is automatically turned off. I don't want to hardcode the program to detect TERM={emacs,dumb}. I am thinking that termcap/terminfo should be able to help with this, but so far I've only managed to cobble together this (n)curses-using snippet of code, which fails badly when it can't find the

How to set custom search paths for the terminfo database when building ncurses from source

六月ゝ 毕业季﹏ 提交于 2020-01-10 15:40:41
问题 How do I set custom search paths for the terminfo database when building ncurses from source? To be more specific, how do I force the primary directory to be searched in '~/.terminfo'? 回答1: From the terminfo manpage: Fetching Compiled Descriptions If the environment variable TERMINFO is set, it is interpreted as the pathname of a directory containing the compiled description you are working on. Only that directory is searched. If TERMINFO is not set, the ncurses version of the terminfo reader

tput: unknown terminal “xterm-256color”

蓝咒 提交于 2020-01-04 05:35:53
问题 I'm running OS X 10.10.5. I'm getting an error trying to open a terminal: tput: unknown terminal "xterm-256color" This is obviously a missing termcap entry. $ port list ncurses ncurses @6.0 devel/ncurses Any ideas how to install 'ncurses-term' on OS X? $ sudo port install ncurses-term Password: Error: Port ncurses-term not found 回答1: The problem was with an Anaconda package: https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/XKMFYqM12Vg It appears there is some problem with an

tput: unknown terminal “xterm-256color”

落爺英雄遲暮 提交于 2020-01-04 05:35:08
问题 I'm running OS X 10.10.5. I'm getting an error trying to open a terminal: tput: unknown terminal "xterm-256color" This is obviously a missing termcap entry. $ port list ncurses ncurses @6.0 devel/ncurses Any ideas how to install 'ncurses-term' on OS X? $ sudo port install ncurses-term Password: Error: Port ncurses-term not found 回答1: The problem was with an Anaconda package: https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/XKMFYqM12Vg It appears there is some problem with an

tmux man-page search highlighting

别来无恙 提交于 2019-12-29 16:28:08
问题 When I search in, for example, man ls while in a tmux session, the search strings don't appear highlighted - the page jumps down so that the search string is on the top line of the buffer, as expected, but it's not highlighted. Doing the same thing in the same shell while not in a tmux session results in highlighted search strings. I have no idea where to start looking to solve this. Any hints are appreciated. 回答1: Based on Less Colors For Man Pages by Gen2ly , here is my man page and how to

ncurses support for italics?

梦想与她 提交于 2019-12-24 11:59:13
问题 Some terminals, such as urxvt, support display text in italics via the sitm and ritm terminfo entries: echo `tput sitm`italics`tput ritm` I'd like to use this in an application I've got which wants to render real italics into the console. Unfortunately the application is ncurses-based, and ncurses doesn't seem to have a attribute for italics --- it's got a whole bunch, including invisible text (which I'm sure is useful for something), but no italics. Does anyone know of a way to trick ncurses

How to properly print special key sequences with terminfo in terminal-agnostic way?

我只是一个虾纸丫 提交于 2019-12-13 00:09:19
问题 I am trying to emulate a user, pressing such special keys as <Left Arrow> , <Backspace> , <Delete> and so on. I heard that curses/terminfo might help to do that in terminal-agnostic way, but when i try (with following code) to print first string "text" and then emmit a key_left sequence, i am not getting a (with '|' as cursor) "tex|t" , but rather "textD|" . Why? How to do that properly? #include <term.h> #include <stdio.h> static void putf(const char *name) { putp(name); fflush(stdout); }

terminfo for windows console that is using read(stdin) for input

馋奶兔 提交于 2019-12-12 03:53:55
问题 I am writing an application that connect to a Linux box from Windows console over a custom socket, and I need to tell the Linux box what my console is capable of through TERM environment variable. For now I set TERM=dumb , but it is too limited. In particular I need Linux side to know that: I am reading input with standard reads from stdin, so no ESC, F1 and arrows are passed (but TAB is) Windows console has autowrap It is unable to process ANSI color sequences It is able to process carriage