Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are no such things as “the” escape codes. Any terminal could have any codes. You would have to look at the TERM environment variable and use codes appropriate for that terminal. There are, of course, libraries to do this for you, such as terminfo and ncurses. But never output raw escape codes yourself - all the world is not a VT100 or Linux terminal.


I think the original poster does not want to output escape codes, he wants to build a terminal that will accept escape codes like a xterm. This way, he won't need to create a new terminal type with all the terminfo or ncurses configuration.


The two other terminal multiplexers I know of are GNU screen and tmux. GNU screen defines its own “screen” terminal type in terminfo, and tmux shamelessly re-uses it and claims to be “screen-256color” (screen with 256 colors). So I don’t think there is any good way to avoid it.


>"shamelessly re-uses it and claims to be “screen-256color”

Could you elaborate on this? Tmux uses the screen terminfo entry? Is it not actually 256?


If I set my terminal type to something basic like vt102, and then start "tmux" and run "echo $TERM", I get "screen-256color". Also, the tmux(1) manual states:

The TERM environment variable must be set to “screen” for all programs running inside tmux. New windows will automatically have “TERM=screen” added to their environment, but care must be taken not to reset this in shell start-up files.

So, yes, Tmux uses the GNU screen terminfo entry.


I just assumed it's what someone who'd actually thought about the problem did for performance.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: