Terminal.app behaves like a dtterm window

Jan 23, '03 08:09:33AM

Contributed by: uucee

For some unknown reason I ran vttest on Terminal.app and instead of behaving only like a VT100 / xterm window, the emulation seems to pick up on Digital's dtterm escape sequences as well.

Comparing the VT100 and dtterm entries with "infocmp," and examining the actual keyboard codes for function keys, shows Terminal.app behaving more like dtterm than vt100.

With vttest it's clear to see that Terminal.app does support color; however, the background/foreground colors seem to be reversed as far as the proper escape sequences go. Nonetheless, lynx (Fink dist) and emacs work just fine with TERM set to "dtterm". Reversing the Background / Normal Color settings in the preferences makes vttest look right but for casual use the defaults fare better.

A nice feature of dtterm: it's possible to resize and dock the window and raise/lower the z-level programmatically. Here are some examples:

  alias hide 'echo -n "^[[2t"'
alias lower 'echo -n "^[[6t"'
alias raise 'echo -n "^[[5t"'
alias 42x80 'echo -n "^[[8;42;80t"'
alias maxh 'echo -n "^[[3;0;t^[[8;0;80t"'
alias maxw 'echo -n "^[[3;0;t^[[8;24;0t"'
alias maxhw 'echo -n "^[[3;0;t^[[8;0;0t"'
With "lower," it's possible to have a window behind others that still has keyboard focus...

How about this for a "make" alias:
  alias makebg 'hide; make !*; raise'
"vttest -l" outputs the various escape codes used in the tests to vttest.log.

[Editor's note: I must admit this is well beyond my knowledge of the Terminal, but I was able to make most of these work by first creating the aliases in my aliases.mine file, and then setting my tcsh terminal type to 'dtterm' with setenv TERM dtterm. To enter the aliases, you need to realize that ^[ is a Control-Open Bracket. You can type this in vi by hitting Control-V Control-Open Bracket, followed by the rest of the text. The author of this hint also has a page of other useful Terminal tricks...]

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030123050933904