P
Pratap Das
Hi All,
I am writing sort of a shell in Perl where I am trying to implement
command recall at shell prompt like you have for zsh/tcsh. So when I
press up/down arrow keys I should be able to get the previous/next
command typed.
I saw code in the web to detect arrow keys in which I have to first
put the terminal into 'cbreak' mode for getting each charcter. And the
echo is turned off. Though I am able to detect the key, since the at
least for the first charater the echo is off (I am turning on the echo
if I see that the character is a normal character) so for all the
other shell commands the first character is not echoed to the screen.
Is there a way in which I can detect the key without switching off the
echo so that all other characters can be echoed but at the same time I
don't want to echo the arrow keys when they are pressed.
Any help is appreciated.
Thanks,
--Das
I am writing sort of a shell in Perl where I am trying to implement
command recall at shell prompt like you have for zsh/tcsh. So when I
press up/down arrow keys I should be able to get the previous/next
command typed.
I saw code in the web to detect arrow keys in which I have to first
put the terminal into 'cbreak' mode for getting each charcter. And the
echo is turned off. Though I am able to detect the key, since the at
least for the first charater the echo is off (I am turning on the echo
if I see that the character is a normal character) so for all the
other shell commands the first character is not echoed to the screen.
Is there a way in which I can detect the key without switching off the
echo so that all other characters can be echoed but at the same time I
don't want to echo the arrow keys when they are pressed.
Any help is appreciated.
Thanks,
--Das