Project

General

Profile

Feature #1917

Updated by shyouhei (Shyouhei Urabe) about 12 years ago

=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 
 

Back