[前][次][番号順一覧][スレッド一覧]

ruby-changes:59318

From: Nobuyoshi <ko1@a...>
Date: Wed, 18 Dec 2019 10:47:14 +0900 (JST)
Subject: [ruby-changes:59318] 77e3078ede (master): [ruby/io-console] Set raw mode strictly same as cfmakeraw

https://git.ruby-lang.org/ruby.git/commit/?id=77e3078ede

From 77e3078ede833e86a1ee0e2ce745b15e892bdbf6 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 18 Dec 2019 10:25:18 +0900
Subject: [ruby/io-console] Set raw mode strictly same as cfmakeraw

* Default VMIN and VTIME to minimum input.
* Disable parity check bits explicitly.
* Disable all bits for flow control on input.

Co-Authored-By: NARUSE, Yui <naruse@a...>

https://github.com/ruby/io-console/commit/5ce201a686

diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index 9bd825a..ac5b6a6 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -165,11 +165,13 @@ set_rawmode(conmode *t, void *arg) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L165
     cfmakeraw(t);
     t->c_lflag &= ~(ECHOE|ECHOK);
 #elif defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H
-    t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+    t->c_iflag &= ~(IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXOFF|IXANY|IMAXBEL);
     t->c_oflag &= ~OPOST;
-    t->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN);
+    t->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN|XCASE);
     t->c_cflag &= ~(CSIZE|PARENB);
     t->c_cflag |= CS8;
+    t->c_cc[VMIN] = 1;
+    t->c_cc[VTIME] = 0;
 #elif defined HAVE_SGTTY_H
     t->sg_flags &= ~ECHO;
     t->sg_flags |= RAW;
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 0b28ff1..219b846 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -352,7 +352,7 @@ defined?(PTY) and defined?(IO.console) and TestIO_Console.class_eval do https://github.com/ruby/ruby/blob/trunk/test/io/console/test_io_console.rb#L352
       if cc = ctrl["intr"]
         assert_ctrl("#{cc.ord}", cc, r, w)
         assert_ctrl("#{cc.ord}", cc, r, w)
-        # assert_ctrl("Interrupt", cc, r, w)
+        assert_ctrl("Interrupt", cc, r, w)
       end
       if cc = ctrl["dsusp"]
         assert_ctrl("#{cc.ord}", cc, r, w)
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]