[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: terminal emulator escape sequences -- was "linux"



Konstantin Scheglov wrote:
> 
> Hello will,
> 
>   As I saw under your letters in conferences, you 
> well understand esc-sequences. Do you know, what mean
> sequences "\E[?0c" and "\E[?1c" in the terminal "linux"?
> 
> --
> Best regards,
>  Konstantin                          mailto:rkosta@inbox.ru

i do? boy do i have you fooled! another victim to my charms! :)

--

i can take a stab at it, though --

the \E usually means the ESCAPE character, which is ascii(27) decimal
or chr("\033") octal. in the old display terminal days of the digital
vt100 and adm3a this was a signal from the minicomputer to the display
monitor that it was about to receive some specific instructions, such 
as 'start displaying everything in bold' or 'move the cursor' or 'set
background color' or 'clear the current line of the display'...

for example: dec vt220 terminals (and emulators thereof) can do these:
	\E[0;1m  --> anything coming after this is printed in bold
	\E[0;4m  --> start using underline
	^O       --> revert to normal charset (handy after you 'cat <binary>')
	             (that's decimal 15, or char("\017") to get your display
	             back after winding up in the secondary charset from
	             viewing a binary file containing a ^N/14/char("\016"))
why the bracket? why the em? i have no idea. them that figgered it out
originally picked symbols that probably meant something to them. it
doesn't really matter which characters they use; what does matter is
that the 'escape sequences' work properly when you want them to.

what the exact "escape sequences" do depends on the "terminal emulation"
you're using. ANSI defines one set of functions, XTERM no doubt uses
another set (even though there may be quite a bit of overlap) and
so forth. (compare: the EXIM manpage is only 1560 lines long -- the
terminfo manpage is 2640! eek!)

to see all the different capabilities POSSIBLE, see "man terminfo" or
"man termcap"... to see which terminal type your console/ssh/telnet
session is emulating do "printenv | grep TERM" or to see the current
emulation you're using, try "infocmp".

(i myself didn't know about all these until just now checking the
"see also" portions at the bottom of various manpages...)

to figure out what particular escape sequences do on your video
emulation, you'll need to do a bit of perusing of the manpages
(particularly 'man terminfo' or the older style 'man termcap').

for example, on my setup, 'infocmp' reports that i've got a setting
	cub1=\E[D
so i look up "cub1" (spelled 'see, you, bee, one') by going to
"man terminfo" and then typing slash (to enter "search" mode) 
and entering "cub1":
    cursor_right        cuf1   nd   non-destructive space
                                    (move right one space)
so my emulator moves the cursor one slot to the right whenever
it sees ESCAPE-LEFTBRACKET-DEE.

it's kinda adventuresome, finding the answers to all this stuff.
(not that that makes it any easier...) of course, it takes a while
to get to the level when you feel you CAN find the answers! knowing
where to look, helps. (good luck with that part...)

--

the only difference between an ordeal and an adventure
is your state of mind.

--

notice how i spent a great deal of time not precisely answering
your direct question? :) in theory, you should be able to find
the answers on your own...

if you need to:
	apt-get install man-db ncurses-bin

-- 

mailto:will@serensoft.com
http://www.dontUthink.com/



Reply to: