1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/io/console/console.c (set_rawmode): clear ECHOE and ECHOK

bits too.
* ext/io/console/console.c (echo_p): ignore ECHOE and ECHOK bits.
  [ruby-dev:45309] [Bug #6116]
* ext/io/console/console.c (console_raw): fix rdoc.
* ext/io/console/console.c (console_set_echo): mentioned about
  platform dependency.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-03-06 01:11:47 +00:00
parent 2706b60ccb
commit dd9569ded8
3 changed files with 38 additions and 12 deletions

View file

@ -125,10 +125,11 @@ set_rawmode(conmode *t, void *arg)
{
#ifdef HAVE_CFMAKERAW
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_oflag &= ~OPOST;
t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
t->c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|ICANON|ISIG|IEXTEN);
t->c_cflag &= ~(CSIZE|PARENB);
t->c_cflag |= CS8;
#elif defined HAVE_SGTTY_H
@ -189,7 +190,7 @@ static int
echo_p(conmode *t)
{
#if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H
return (t->c_lflag & (ECHO | ECHOE | ECHOK | ECHONL)) != 0;
return (t->c_lflag & (ECHO | ECHONL)) != 0;
#elif defined HAVE_SGTTY_H
return (t->sg_flags & ECHO) != 0;
#elif defined _WIN32
@ -295,7 +296,7 @@ ttymode(VALUE io, VALUE (*func)(VALUE), void (*setter)(conmode *, void *), void
*
* STDIN.raw(&:gets)
*
* will read and return a line with echo back and line editing.
* will read and return a line without echo back and line editing.
*
* You must require 'io/console' to use this method.
*/
@ -419,6 +420,8 @@ console_noecho(VALUE io)
* io.echo = flag
*
* Enables/disables echo back.
* On some platforms, all combinations of this flags and raw/cooked
* mode may not be valid.
*
* You must require 'io/console' to use this method.
*/