[comp.unix.wizards] termcap "sg#0" capability

rmg@mips.UUCP (10/28/87)

I have a question about the semantics of the "sg" terminal capability.

The BSD 4.3 termcap(5) manual page describes "sg" thus:

       ...
>      sg    num          Number of garbage chars left by so or se (default 0)
       ...
>      The sequences to enter and
>      exit standout mode are given as so and se, respectively.  If
>      the code to change into or out of standout mode leaves one
>      or even two blank spaces or garbage characters on the
>      screen, as the TVI 912 and Teleray 1061 do, then sg should
>      be given to tell how many characters are left.

Notice that the manual page specifies a default of 0 for the sg
attribute.  I initially interpreted this to mean that a terminal
description with an explicit sg#0 should be equivalent to one with no
sg capability given.

However, I have a termcap driven program which behaves differently
when sg#0 is specified than when no sg capability is given. The
developer asserts that there *is* a semantic difference between sg#0
and no sg.  Since sg is the number of "blank spaces or garbage
characters on the screen", I can't imagine what the difference is.  I
haven't worked with terminals that do this, so maybe I don't
understand what these "magic cookies" do for the terminal. Can
somebody enlighten me?

-- 
- Rich Geiger
{ames,decwrl,pyramid}!mips!rmg		
MIPS Computer Systems, 930 E. Arques, Sunnyvale, CA 94086
(408) 720-1700 x308 [Day Job]  (408) 739-7911 [home]

gwyn@brl-smoke.ARPA (Doug Gwyn ) (10/30/87)

In article <847@quacky.UUCP> rmg@mips.UUCP (Richard M. Geiger) writes:
>However, I have a termcap driven program which behaves differently
>when sg#0 is specified than when no sg capability is given. The
>developer asserts that there *is* a semantic difference between sg#0
>and no sg.

The developer is wrong.  I know that some people have tried to give
special semantics to sg#0 and ug#0, but it has never to my knowledge
been adopted in the official termcap (or terminfo) documentation,
and when I updated TERMCAP(5) for 4.3BSD I continued to uphold this
tradition.

If the developer can explain what he thinks the special semantics
should be, have him contact me.

	Gwyn@BRL.MIL

blarson@skat.usc.edu (Bob Larson) (10/31/87)

In article <847@quacky.UUCP> rmg@mips.UUCP (Richard M. Geiger) writes:
>I have a question about the semantics of the "sg" terminal capability.

>The BSD 4.3 termcap(5) manual page describes "sg" thus:
>>      sg    num          Number of garbage chars left by so or se (default 0)
>       ...
>>      The sequences to enter and
>>      exit standout mode are given as so and se, respectively.  If
>>      the code to change into or out of standout mode leaves one
>>      or even two blank spaces or garbage characters on the
>>      screen, as the TVI 912 and Teleray 1061 do, then sg should
>>      be given to tell how many characters are left.

>Notice that the manual page specifies a default of 0 for the sg
>attribute.  I initially interpreted this to mean that a terminal
>description with an explicit sg#0 should be equivalent to one with no
>sg capability given.

Terminals without standout glitch put the charcter attribute specified
on each character printed between the attribute start and attribute
end sequences.  Cursor motion may or may not be allowed.

Terminals with standout glitch use the character attribute specified
between the character position of the attribute start magic cookie and
the attribute end magic cookie (or the end of the screen).

Now how does one describe a terminal to termcap that uses magic
cookies that take no screen positions?  If you have a line in reverse
vidio, and want to change characters in the middle, you can not
treat this the same as no standout glitch.

I use sg#0 to denote the third type of terminal to MicroGnuEmacs (mg).  A
non-obvious problem with this is what happens when you print
characters to the end of line then send the code to end the attribute,
position to the first character of the next line, then do a clear to
end of line.  (Answer on one terminal I have: the rest of the screen
winds up in reverse vidio.)  mg avoids printing to the end of line on
sg#0 reverse lines to avoid this.

Is there a better way to do this?
--
Bob Larson		Arpa: Blarson@Ecla.Usc.Edu
Uucp: {sdcrdcf,cit-vax}!oberon!skat!blarson		blarson@skat.usc.edu
Prime mailing list (requests):	info-prime-request%fns1@ecla.usc.edu

allbery@ncoast.UUCP (Brandon Allbery) (11/05/87)

As quoted from <6625@brl-smoke.ARPA> by gwyn@brl-smoke.ARPA (Doug Gwyn ):
+---------------
| The developer is wrong.  I know that some people have tried to give
| special semantics to sg#0 and ug#0, but it has never to my knowledge
| been adopted in the official termcap (or terminfo) documentation,
| and when I updated TERMCAP(5) for 4.3BSD I continued to uphold this
| tradition.
| 
| If the developer can explain what he thinks the special semantics
| should be, have him contact me.
+---------------

Judging from messages on Info-GNU-Emacs, it's none other than RMS; his idea
of sg#0 usage is that leaving out the sg attribute means that the cursor can
move in standout mode.  In other words, he uses sg as an inverse ms (terminfo
"msgr") attribute.

Does RMS ever read man pages, for goodness' sake?
-- 
Brandon S. Allbery		     necntc!ncoast!allbery@harvard.harvard.edu
 {harvard!necntc,well!hoptoad,sun!mandrill!hal,uunet!hnsurg3}!ncoast!allbery