Basic cursor motion without curses

Basic cursor motion without curses

Post by Tim Widri » Thu, 02 May 1996 04:00:00



I'm writing a program that requires a line editor (like the one
Matlab or the shells "tcsh" and "bash" use).  Currently I use
curses, but want to move away from it for several reasons.
Essentially curses tries to do too much for what I want.

Specifically, how does one program the following (without curses):
  - move the cursor anywhere on current line
  - clear the screen and move to the top

I know how put the terminal in raw or cbreak mode, but cursor
movement on different terminals eludes me.  (Before I started
using curses, I actually used stuff like 'printf( "%c", 8 );'
to move backwards!  This didn't work very well on different
terminals.)

I have looked, briefly, at readline:  too much to digest.  Do I
need to go to the bookstore and buy something on termcap or
terminfo?  Is there a FAQ that might help?  My main targets right
now are Linux PC's and HP workstations.

Any pointers would be greatly appreciated!

Tim

 
 
 

Basic cursor motion without curses

Post by Stan Mil » Fri, 03 May 1996 04:00:00


: I'm writing a program that requires a line editor (like the one
: Matlab or the shells "tcsh" and "bash" use).  Currently I use
: curses, but want to move away from it for several reasons.
: Essentially curses tries to do too much for what I want.

: Specifically, how does one program the following (without curses):
:   - move the cursor anywhere on current line
:   - clear the screen and move to the top

: I know how put the terminal in raw or cbreak mode, but cursor
: movement on different terminals eludes me.  (Before I started
: using curses, I actually used stuff like 'printf( "%c", 8 );'
: to move backwards!  This didn't work very well on different
: terminals.)

: I have looked, briefly, at readline:  too much to digest.  Do I
: need to go to the bookstore and buy something on termcap or
: terminfo?  Is there a FAQ that might help?  My main targets right
: now are Linux PC's and HP workstations.

: Any pointers would be greatly appreciated!

: Tim

What you need to do is learn to use the TERMCAP, or TERMINFO libraries.
This is what most UNIX programs such as VI, ELM, etc... do to do their
own cursor control.  A good book on CURSES will also cover these topics.
I would suggest "UNIX CURSES Explained" by Bernie Goodheart.

Regards,
Stan Milam.

 
 
 

1. Can I write curses-like application without using <curses.h>?

I am writting a client/server program. What I want to do is that let
the message typed on the client's screen, by the user being seperated
the message sent by the server, so the client's screen does not mess up,
just like the IRC program does.

I know I can use <curses.h>, but it turns out to be rather slow,
especially for SGI machines. What i did it to open 3 windows. The top one
is for message from the server, the bottom on is for message typed by
the user, the middle one displays a message in reverse video mode just
like IRC program. When the top window is full, the scrolling is slow.
And also for SGI machines, every time when I move the cursor from one
window to another, it redraws the whole screen, the screen blinks.

What I want to do is just the program itself handles redrawing etc,
without using curses facilities. Is it possible? How can one posision
the cursor, etc?

Thanks

2. Apache on Linux 1.2.13 - Does it work?

3. Strange X cursors, #9 Motion 771

4. Audio on NEC Versa 4000 family laptops?

5. terminfo to termcap conversion for cursor motion

6. Linux Magazine?

7. cursor motion for ibm3151 in wide mode

8. Help with Fasttrack/100 Raid on Linux

9. curses curses curses

10. Cursor in curses (argh!)

11. Curses cursor

12. Curses in Sun OS, and turning th cursor off

13. Curses: How to change the cursor type & mode