Bug #1917: Curses::Window#keypad(true) fails for Curses::Key::ENTER ?
http://redmine.ruby-lang.org/issues/show/1917

Author: Robert Gleeson
Status: Open, Priority: Normal
ruby -v: ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]

I am not too sure if this is a bug, my apologizes if it is not.
After creating an instance of Curses::Window, setting keypad to true, it is possible to catch Curses::Key::UP/DOWN/LEFT/RIGHT, but when I try to catch Curses::Key::ENTER, it fails.
On the pressing of enter, "10" char code is returned or "\n", but Curses::Key::ENTER is equal to "343".
Here is an example case:

require 'curses'

Curses::init_screen
w = Curses::Window.new 20,60,0,0
w.box ?|, ?-
w.keypad true
chr = w.getch
w.setpos 2,4
w.addstr %q{Caught enter} if chr == Curses::Key::ENTER
w.addstr %q{Caught "\n"} if chr.chr == "\n"
w.refresh
w.getch
Curses::close_screen

Again, apologizes if this is not a bug, I do not want to waste anyone's time, but it felt odd to me, that other keys, such as Curses::Key::UP/DOWN/LEFT/RIGHT could be caught but not ENTER.


----------------------------------------
http://redmine.ruby-lang.org