I tried to teach myself ncurses, and I still love it. However, I am trying to write a small small text editor such as pico or nano. So far it has been good. I created a function to display keys. No matter what I do, I cannot get a response from KEY_ENTER. Whenever I click on it, it just jumps to the beginning of the current line I'm in. I tried using raw (); and use 13 instead of "KEY_ENTER" no luck. All other keys respond as expected. I would be grateful for any advice. I looked at it, trying to make it work forever. Thank you
void keymaps(){
int ch;
keypad(stdscr,TRUE);
case KEY_UP:
addstr("Up\n");
break;
case KEY_LEFT:
addstr("Left\n");
break;
case KEY_RIGHT:
addstr("Right\n");
break;
case KEY_BACKSPACE:
delch();
break;
case Key_Enter:
addstr("You pressed Enter\n");
default:
break;
}
refresh();
} while(ch != KEY_HOME);
}
source
share