From e3b9ed7649a62d37fce1f588cd84802c93331520 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 5 Apr 2013 04:23:05 +0000 Subject: [PATCH] curses.c: fix function * ext/curses/curses.c (Init_curses): fix implementation function, crmode should be same as cbreak. [ruby-core:54013] [Bug #8222] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/curses/curses.c | 2 +- test/test_curses.rb | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e34df73646..e809b06581 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Apr 5 13:22:59 2013 Nobuyoshi Nakada + + * ext/curses/curses.c (Init_curses): fix implementation function, + crmode should be same as cbreak. [ruby-core:54013] [Bug #8222] + Fri Apr 5 12:06:00 2013 Zachary Scott * ext/curses/hello.rb: Typo in Curses example by Drew Blas diff --git a/ext/curses/curses.c b/ext/curses/curses.c index 175e32cff9..88b1bdb3aa 100644 --- a/ext/curses/curses.c +++ b/ext/curses/curses.c @@ -2715,7 +2715,7 @@ Init_curses(void) rb_define_module_function(mCurses, "noraw", curses_noraw, 0); rb_define_module_function(mCurses, "cbreak", curses_cbreak, 0); rb_define_module_function(mCurses, "nocbreak", curses_nocbreak, 0); - rb_define_module_function(mCurses, "crmode", curses_nocbreak, 0); + rb_define_module_function(mCurses, "crmode", curses_cbreak, 0); rb_define_module_function(mCurses, "nocrmode", curses_nocbreak, 0); rb_define_module_function(mCurses, "nl", curses_nl, 0); rb_define_module_function(mCurses, "nonl", curses_nonl, 0); diff --git a/test/test_curses.rb b/test/test_curses.rb index d59f7dd354..9432c024bb 100644 --- a/test/test_curses.rb +++ b/test/test_curses.rb @@ -51,4 +51,10 @@ src def test_getch_nocbreak assert_raise(Timeout::Error) {run_curses("nocbreak; getch", "a")} end + def test_getch_crmode + assert_equal("a", run_curses("crmode; getch", "a")) + end + def test_getch_nocrmode + assert_raise(Timeout::Error) {run_curses("nocrmode; getch", "a")} + end end if defined? TestCurses and defined? PTY