termcap

Print embedded Pod as formatted text with termcap escapes

删除回忆录丶 提交于 2019-12-23 10:25:41
问题 I am trying to output embedded Pod as ANSI text to the terminal. In Perl 5 I can use Pod::Text::Termcap: use strict; use warnings; use Pod::Text::Termcap; my $str = do {local $/; <DATA>}; my $parser = Pod::Text::Termcap->new(); $parser->parse_string_document( $str, \*STDERR ); __DATA__ =head1 SYNOPSIS my_test_command I<filename> [OPTIONS] =head1 ARGUMENTS =over 4 =item I<filename> File name to test =back =head1 OPTIONS =over 4 =item B<--help> Prints help =back =head1 DESCRIPTION A sample test

Termcap with parameters

纵饮孤独 提交于 2019-12-14 03:59:47
问题 I am coding a shell-like in C and I want to implement the line edition functionality, I already implemented the basic of it, now I want to implement ctrl+l which clear the screen then display the prompt and the line I was working on. I need to use the termcap : 'cm' String to position the cursor at line l, column c. My question is how to I pass the variable l and c to the termcap ? 回答1: Suppose you have the cm capability stored in the term_cm variable. Then you would substitute parameters

Implement overlay in terminal

橙三吉。 提交于 2019-12-13 07:57:34
问题 I want to create an overlay in terminal This Q&D shows the time in right/bottom #include <stdio.h> #include <stdlib.h> #include <termcap.h> #include <termios.h> #include <error.h> #include <unistd.h> #include <time.h> static char termbuf[2048]; int main() { char *termtype = getenv("TERM"); time_t timer; char buffer[26]; struct tm* tm_info; if (tgetent(termbuf, termtype) < 0) { error(EXIT_FAILURE, 0, "Could not access the termcap data base.\n"); return 1; } int lines = tgetnum("li"); int

Color termcaps Konsole?

久未见 提交于 2019-12-13 04:54:19
问题 I've got a problem with ANSI escape codes in my terminal on OpenSuse 13.2. My Makefile use to display pretty colors on OSX at work but at home when I use it I get the litteral termcaps such as \033[1;30m ... \033[0m I know close to nothing about termcaps, I just found these escape characters that seemed to be working fine ! The strangest is that both my OSX and Linux terminal are configured with TERM=xterm-256color so I really don't know where to look for the correct setting I'm currently

Display inverse video text with python on terminal

北战南征 提交于 2019-12-12 18:18:56
问题 Python has a curses module. Is there a simple way to use this module to display inverse video text? I don't want to do the full-blown curses application, just want the text to bring inverse (or in color). 回答1: If you use the filter function (before initscr), the curses application will only update the current line of the screen (and will not clear the whole screen). That would be a minimal use of the curses library. If you want a lower-level (no optimization, do it yourself), you would have

Terminfo smkx and Application Cursor Keys vs Application keypad

妖精的绣舞 提交于 2019-12-10 15:09:34
问题 XTerm Control Sequences specifies the following key sequences: CSI ? 1 h → Application Cursor Keys (DECCKM) CSI ? 1 l → Normal Cursor Mode (DECOM) CSI ? 66 h → Application keypad (DECNKM) CSI ? 66 l → Numeric keypad (DECNKM) and the Terminfo Source Format has the following entry: Variable: keypad_xmit Capname: smkx Termcap: ks Description: Put terminal in "keypad-transmit" mode But the terminfo for xterm actually says smkx=\E[?1h\E= , which seems mixed up to me (smkx should affect the keypad,

Unix screen utility error: Cannot find termcap entry for 'xterm-256color'

不打扰是莪最后的温柔 提交于 2019-12-03 11:44:52
问题 I work on a NetBSD system through an ssh connection from my Mac and I want to use the screen utility so that I can start processes and come back to them after my terminal connection has been interrupted. When I type screen I get the error message: Cannot find termcap entry for 'xterm-256color' After looking through forum posts, I thought it had something to do with termcap on the remote machine, but that appears not to be the case; I can initiate screen with no errors from an ssh session from

Unix screen utility error: Cannot find termcap entry for 'xterm-256color'

泄露秘密 提交于 2019-12-03 02:05:41
I work on a NetBSD system through an ssh connection from my Mac and I want to use the screen utility so that I can start processes and come back to them after my terminal connection has been interrupted. When I type screen I get the error message: Cannot find termcap entry for 'xterm-256color' After looking through forum posts, I thought it had something to do with termcap on the remote machine, but that appears not to be the case; I can initiate screen with no errors from an ssh session from another computer, one to which I don't generally have access. This suggests that I need to configure

Why is terminfo[kcuu1] = '\EOA'?

北慕城南 提交于 2019-12-02 03:30:36
问题 From what I can tell reading terminfo(5) , kcuu1 should be the sequence that the terminal sends when the up arrow is pressed. I have never, ever seen that be anything other than ^[[A (speaking now about cat , messed up terminal settings, etc). So, given that the terminals I've used (rxvt, gnome-terminal, iTerm) all default to TERM=xterm, why isn't kcuu1 \E[A ? I see that cuu1 is \E[A , but (from the man page, again), that's the string that I should send to the terminal to move the cursor, not

Why is terminfo[kcuu1] = '\\EOA'?

老子叫甜甜 提交于 2019-12-02 02:23:56
From what I can tell reading terminfo(5) , kcuu1 should be the sequence that the terminal sends when the up arrow is pressed. I have never, ever seen that be anything other than ^[[A (speaking now about cat , messed up terminal settings, etc). So, given that the terminals I've used (rxvt, gnome-terminal, iTerm) all default to TERM=xterm, why isn't kcuu1 \E[A ? I see that cuu1 is \E[A , but (from the man page, again), that's the string that I should send to the terminal to move the cursor, not a string the terminal sends to me. BTW this is with OS X. melpomene Arrow and other special keys