Which terminal should I emulate ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
karuon
Posts: 22
Joined: Sat Jun 29, 2013 6:16 am

Which terminal should I emulate ?

Post by karuon »

Hi,

I'm currently rewriting the terminal emulator part of my OS (previously a really basic VT100 emulation) and I'd like to know which terminal model I should emulate to allow (n)curses programs to use color.

To figure this out, I first focused on VT*** models. I experimented on Linux by changing the TERM environment variable of my shell. I first tried vt100, then vt102, etc. until my console text editor (vim) was able to color a source code. It worked for TERM=vt320 and not for lower versions (instead of being colored, the text was underlined or set bold).

Considering this results led me to conclude that VT100 terminals did not support color and that I should emulate at least VT320 to allow curses programs to use color. Is that true?

Thanks in advance.
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Which terminal should I emulate ?

Post by Nable »

Just the first idea that came to me:

Code: Select all

$ echo $TERM
xterm
Ok, but I don't know what does `TERM=xterm' mean. If I understanding correctly what wiki tells then it's somehow connected with VS100.
Btw, I've read more and was surprised by the fact how really powerful things were VT220+ terminals: http://en.wikipedia.org/wiki/Sixel , http://en.wikipedia.org/wiki/ReGIS

Upd: oh, shame on me for not googling before posting. For example, here's an explanation of what xterm means and what terminal features it provides(emulates) : http://invisible-island.net/xterm/xterm.faq.html
The xterm program is a terminal emulator for the X Window System. It provides DEC VT102/VT220 and selected features from higher-level terminals such as VT320/VT420/VT520 (VTxxx). It also provides Tektronix 4014 emulation for programs that cannot use the window system directly. If the underlying operating system supports terminal resizing capabilities (for example, the SIGWINCH signal in systems derived from 4.3bsd), xterm will use the facilities to notify programs running in the window whenever it is resized.
Implementing full and correct emulator of some real-world hardware is a difficult task. But it seems to me that subset of features that can be found in xterm is something standard and widely used. I.e. many other terminal emulators try to follow xterm.
karuon
Posts: 22
Joined: Sat Jun 29, 2013 6:16 am

Re: Which terminal should I emulate ?

Post by karuon »

I did look at the original TERM environment variable before changing it. It's indeed set to 'xterm'.

I've also read some documents about xterm but I wondered whether I needed to implement all xterm features to get only VT100 features + 16 colors supported (I'm currently running in text mode).
Post Reply