[comp.terminals] Adding 2 to a %d in TERMCAP

rrauenza@polyslo.CalPoly.EDU (Who, Me??) (01/03/91)

    I am modifying a VT100 termcap entry to more or less shift the
screen down one row.  (To allow a status line at the top of the
screen.) The two commands that I am having problems changing are cs 
and cm (Set scroll region and goto row, column).

   The problem is that the cm is currently set to cm=5\E[%i%d;%dH and
cs set to cs=\E[%i%d;%dr. Since the row parameter is already increased
by one by the %i, I can't increase it again with %i (I tried and it
increased the second parameter (%i%i%d;%dr))

   I considered using %>xy, but that would fail when the row ='s 0 (the
lowest x I could have would be 0).

   So, how can I add one more to a parameter that is already %i'd?


   Thanks for any help!
		Rich Rauenzahn

(Although I'd still like to find out the answer - if anyone has a
termcap entry for vt100 that has a status line (top or bottom -
preferably top) I'd appreciate a copy!  Thanks again..)


-- 
+-------------------------- ----+- - - ----- --------- - -	-	-- -  +
| rrauenza@PolySlo.CalPoly.EDU  |  Hi!  I'm a  1         ( rest of sig under  )
| rrauenza@Ares.CalPoly.EDU     |            ----- Major ( construction until )
+------------ - -- - -  --- - - + - -         sin        ( further notice...  )

pdk@pyrnj.uucp (Paul Kramer) (01/05/91)

In article <27827b34.4ede@petunia.CalPoly.EDU> rrauenza@polyslo.CalPoly.EDU (Who, Me??) writes:
>    I am modifying a VT100 termcap entry to more or less shift the
>screen down one row.  (To allow a status line at the top of the
>   The problem is that the cm is currently set to cm=5\E[%i%d;%dH and
>cs set to cs=\E[%i%d;%dr. Since the row parameter is already increased
>by one by the %i, I can't increase it again with %i (I tried and it
>increased the second parameter (%i%i%d;%dr))
>   So, how can I add one more to a parameter that is already %i'd?

If you use the "%+" operator to increment the parameters, there are
at least three ways that you could define each termcap parameter.

By adding a "%+1" to "cm=5\E[%i%d;%dH" becomes: "cm=5\E[%i%+1;%dH" which
retains the incrementing and adds another '1' to the first parameter.
The other possibilities are: "cm=5\E[%+2;%+1H" which adds the desired
values individually to each parameter, and "cm=\5\E[%+2;%i%dH" which uses
the increment operator on the second parameter instead of the "%+!".

Using the same rules on the "cs=\E[%i%d;%dr" string would result in the
following:

cs=\E[%i%+1;%dr
cs=\E[%+2;%+1r
cs=\E[%+2;%i%dr

Warning: I tested these by converting the termcap entry to a terminfo and
running `tput cup 0 0`, I didn't have a termcap program to run them against.
You will obviously need to verify these thoroughly.

cheers,
paul davis kramer

rrauenza@polyslo.CalPoly.EDU (Who, Me??) (01/05/91)

pdk@pyrnj.UUCP (Paul Kramer) writes:
>In article rrauenza@polyslo.CalPoly.EDU (Who, Me??) writes:
>>    I am modifying a VT100 termcap entry to more or less shift the
>>screen down one row.  (To allow a status line at the top of the
>>   The problem is that the cm is currently set to cm=5\E[%i%d;%dH and
>>cs set to cs=\E[%i%d;%dr. Since the row parameter is already increased
>>by one by the %i, I can't increase it again with %i (I tried and it
>>increased the second parameter (%i%i%d;%dr))
>>   So, how can I add one more to a parameter that is already %i'd?
>
>If you use the "%+" operator to increment the parameters, there are
>at least three ways that you could define each termcap parameter.
>
[...]
>cheers,
>paul davis kramer


    My first thought was to try to use the %+ operator.. the problem is
that the vt100 needs the col/row code in printf %d format, not %c...

(excerpt from our man page..)

     The % encodings have the following	meanings:
 
          %%   output `%'
          %d   output value as in printf %d
          %2   output value as in printf %2d
          %3   output value as in printf %3d
          %.   output value as in printf %c
          %+x  add x to value, then do %.
          %>xy if value > x then add y, no output
          %r   reverse order of two parameters, no output
          %i   increment by one, no output
          %n   exclusive-or all parameters with 0140 (Datamedia 2500)
          %B   BCD (16*(value/10)) + (value%10), no output
          %D   Reverse coding (value - 2*(value%16)), no output (Delta Data)

----------


   The %+x would output a character, rather than a string representing the
row or col.  Thanks anyway... 

	Rich Rauenzahn


-- 
+-------------------------- ----+- - - ----- --------- - -	-	-- -  +
| rrauenza@PolySlo.CalPoly.EDU  |  Hi!  I'm a  1         ( rest of sig under  )
| rrauenza@Ares.CalPoly.EDU     |            ----- Major ( construction until )
+------------ - -- - -  --- - - + - -         sin        ( further notice...  )