Unix Programming - ncurses and key commands

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2007 > ncurses and key commands





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ncurses and key commands
lnatz

2007-02-08, 1:29 am

Hi,
I am writing a shell and am using ncurses to recognize key commands
like up_arrow(KEY_UP) and down_arrow(KEY_DOWN). In a unix/linux OS
the
up arrow would give you the last command you input. I am trying to do
that, but I don't know how to explain it well but I am trying to get
that browsing look. I can access the history and retrieve the last
command but if i want to browse three or four further back I can't
get
it to act the same way as the OS does. What I mean is that in a unix
shell, if you press the up arrow it would give you the last command
you input and if you press the up arrow several more times, the input
is simply replaced. I can't get it to replace the previous input.

I am sorry for my poor explanation but if anyone understands what I
mean, I would greatly appreciate your help.


Thank you in advance,
natalie

lnatz

2007-02-08, 1:29 am

just to add, when i said browsing I meant scrolling


Christopher Layne

2007-02-08, 1:29 am

lnatz wrote:

> just to add, when i said browsing I meant scrolling


You want to clear to the end of line before you redraw the contents of the
last command.

man curs_clear

Also, what you are embarking on has been done already by readline, and it's no
small feat to work out all of the corner cases and exceptions once you go
multi-line.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com