Project

General

Profile

Actions

Feature #1917

closed

Curses::Window#keypad(true) fails for Curses::Key::ENTER ?

Added by robert (Robert Gleeson) over 14 years ago. Updated almost 12 years ago.

Status:
Third Party's Issue
Target version:
-
[ruby-core:24847]

Description

=begin
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.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0