[comp.unix.questions] curses question

jjv3345@ritcv.UUCP (Jeff Van Epps) (05/20/88)

Folks,
 
I have a Unix program which takes advantage of the curses library for all
of its screen I/O.  In a select few places where I am using standout mode
while displaying text, I lose characters from the strings being output.
This ONLY HAPPENS in a suntools environment.  For the most part, the package
works well, but in suntools, inside of a shelltool, this character loss 
takes place.  I went so far as doing an waddstr and a wrefresh between two
sleep statements, to assure that I wasn't blowing something away, and not
seeing it because of swift I/O.  Is it possible that the I/O in bold is
too fast for the window?  Any advise appreciated.
 

chris@mimsy.UUCP (Chris Torek) (06/03/88)

In article <440@wpg.UUCP> russ@wpg.UUCP (Russell Lawrence) writes:
>The program must be able to clear specific windows from a user's 
>terminal WITHOUT overwriting the data in the particular WINDOW 
>structure.  This requirement rules out the use of werase() or wclear() 
>but also facilitates redisplaying the "erased" window.  

You may be able to do it by opening new blank windows over the old
nonblank windows, but it sounds to me as though you need a real window
manager.  Some years ago, I got tired of fighting `curses', and wrote
something called the Maryland Window Library.  There are no doubt still
copies of it out there, since I posted it.  It has its own
idiosyncrasies (`bugs' :-) ---the whole thing should be rewritten), but
hiding a window from a user without destroying the window is trivial:

	Whide(w);
	Wrefresh();

does it.

	Wunhide(w);
	Wrefresh();

brings it back.  The most major difference between Maryland Windows and
curses is that MW understands `layering' of windows, and that MW has a
fancy screen update algorithm (adapted from the one in Gosling's ACM
article and in an old version of his Emacs) that consumes too much CPU
time but does use insert and delete.  MW also handles four modes (bold,
blink, underline, and inverse-video), assuming the terminal is able
to display such.

Someone should rewrite MW, clean it up and modernise it (termcap
has changed since its day), and then maybe we could supplant curses
as the tty display-handler of choice ... but I doubt it.  :-)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

leo@philmds.UUCP (06/09/88)

In article <440@wpg.UUCP> russ@wpg.UUCP (Russell Lawrence) writes:
>
>I'm working on an curses application that requires *lots* of windows.  
>The program must be able to clear specific windows from a user's 
>terminal WITHOUT overwriting the data in the particular WINDOW 
>structure.  This requirement rules out the use of werase() or wclear() 
>but also facilitates redisplaying the "erased" window.  
>
>Unless I missed something in the manuals, the curses library does not 
>include a function that would meet this need, so I decided to write my 
>own.  I figured I could get the specs for the physical location of a 
> ...[stuff deleted]...

You CAN do it using curses I think:
create a window with the same boundaries as your particular window
and uses this instead of the original.
So:
do updates on original window
use overwrite(org,new) to write it on the new window
use wrefresh(new) to copy to the screen
Now if you want to clear parts of the window, use
werase(new) and wrefresh(new),
use overwrite(org,new), wrefresh(new) to restore.

In fact you use the original as a backup, the new as the window you work
with. You could even use several dump levels 8-).

Hope this helps?

	Leo.

dlsc1032@dlscg1.UUCP (Alan Beal) (06/22/88)

I am looking for an example curses program that forks/execs a process, reads
the output(both stdout and stderr) from the process, and displays the output
in a small window by scrolling.  The output window will be a small part of
the original screen and I would like the process's output to only scroll 
within the output window.  In an attempt to learn how to do this, I have
found that using mvwaddstr() will not cause scrolling if you move text 
beyond the limits(x-axis) of the defined window.  If I just keep using
addstr(), the text will go beyond the x and y limits of the window and
logical scrolling will occur.  Is there a proper way to do all of this?    
I am using the Nutshell Curses book as a reference but as usual there are
too few examples and only short explanations.  Are there any more fuller
discussons or examples of how to use curses in this manner out there?

-- 
Alan Beal   DLSC-ZBC                 Autovon    932-4160
Defense Logistics Services Center    Commercial (616)961-4160
Battle Creek, MI 49015               FTS        552-4160
UUCP:  {uunet!gould,cbosgd!osu-cis}!dsacg1!dlscg2!abeal

leo@philmds.UUCP (Leo de Wit) (06/29/88)

In article <376@dlscg1.UUCP> dlsc1032@dlscg1.UUCP (Alan Beal) writes:
|I am looking for an example curses program that forks/execs a process, reads
|the output(both stdout and stderr) from the process, and displays the output
|in a small window by scrolling.  The output window will be a small part of
|the original screen and I would like the process's output to only scroll 
|within the output window.  In an attempt to learn how to do this, I have
|found that using mvwaddstr() will not cause scrolling if you move text 
|beyond the limits(x-axis) of the defined window.  If I just keep using
|addstr(), the text will go beyond the x and y limits of the window and
|logical scrolling will occur.  Is there a proper way to do all of this?    
|I am using the Nutshell Curses book as a reference but as usual there are
|too few examples and only short explanations.  Are there any more fuller
|discussons or examples of how to use curses in this manner out there?

From the article Screen Updating and Cursor Movement Optimization:
A Library Package (by Kenneth C.R.C. Arnold):

scrollok(win,boolf)
WINDOW win;
bool boolf;

    Sets the scroll flag for the given window. If boolf is FALSE, scrolling
    is not allowed. This is its default setting.

Perhaps using scrollok() on your window with boolf == TRUE solves your
problem.

    Leo.

nevin1@ihlpb.ATT.COM (Liber) (04/01/89)

We have a program which uses curses for an interface.  Some of the
users of this program, however, use a program similar to tee (but it
understands both input and output) as part of their environment.  The
curses-based program won't work with this other program, however.  Does
anyone know of a way around this problem?

Thanks, and please respond via email to iee-help@wham.ATT.COM (if you
are using reply, substitute wham for ihlpb and iee-help for nevin1), as
I will be on vacation next week.
-- 
 _ __	NEVIN ":-)" LIBER  nevin1@ihlpb.ATT.COM  (312) 979-4751  IH 4F-410
' )  )			 "I will not be pushed, filed, stamped, indexed,
 /  / _ , __o  ____	  briefed, debriefed or numbered!  My life is my own!"
/  (_</_\/ <__/ / <_	As far as I know, these are NOT the opinions of AT&T.