You are not logged in.
I just had a brief stint with Ubuntu to look at Hardy Heron and I was writing an ncurses program (a light-weight Orpie-like thing).
When I reinstalled Arch, I continued work on the program only to find that an ncurses feature I was relying on was not working like it had in Ubuntu.
The snippet can be basically reduced down to this:
#include <ncurses.h>
int main( void ) {
int ch;
cbreak();
keypad( stdscr, TRUE );
initscr();
ch = getch();
if ( ch == KEY_BACKSPACE )
addstr( "The Backspace key was pressed!" );
else
addstr( "Test failed" );
refresh();
getch();
endwin();
return 0;
}
gcc -Wall -Wextra -lncurses test.c -o test
The backspace key is NOT recognized by getch() and I have no idea why. I was going to file a bug report, but I wanted to make sure that it's not my mistake.
Can anyone confirm that validity of this sample? Am I expecting the wrong behaviour?
EDIT: The mods might want to move the thread. I didn't really know where to put it.
Last edited by Jessehk (2008-07-30 15:07:38)
Offline
I just tested it in xterm, and everything works as expected. So gnome-terminal is the problem here.
I did a bit of research and I think it might have something to do with terminfo but I am really overwhelmed by the complexity of it.
Any help would be great.
Offline
Right click on the gnome-terminal -> Edit Current Profile... -> Compatibility tab -> Backspace key generates ... change this to Control-H
FWIW, in running your test script it failed on both Ubuntu and my arch, I believe initscr() line is supposed to be before keypad() line.
As far as terminfo's go, the default $TERM is set to xterm, and there is a difference in the xterm termcaps for Arch and Ubuntu (compared using 'infocmp | grep kbs'), so another alternate solution would be to 'export TERM=gnome-256color' in your .bashrc or such, so gnome-terminals start using that terminfo (which then won't require any change to gnome-terminal's settings). Added bonus you get more colors for vim!
Offline
another alternate solution would be to 'export TERM=gnome-256color' in your .bashrc or such, so gnome-terminals start using that terminfo (which then won't require any change to gnome-terminal's settings). Added bonus you get more colors for vim!
That worked! Thanks.
Offline