Commit graph

160 commits

Author SHA1 Message Date
Nobuyoshi Nakada
be575a6eef
[ruby/io-console] Use sys_fail_fptr macro
2b8ba023c8
2020-05-09 17:05:14 +09:00
Nobuyoshi Nakada
0ce45db115 [ruby/io-console] Show path name at error
6a4b1c1a6d
2020-05-09 13:56:55 +09:00
Nobuyoshi Nakada
dec802d8b5 [ruby/io-console] [DOC] Improved about intr:
82b630cd79
2020-02-17 12:05:09 +09:00
Nobuyoshi Nakada
78282d4655
[ruby/io-console] Prefer keyword arguments
5facbfc4c8
2020-02-14 20:30:34 +09:00
Nobuyoshi Nakada
4e56ec4ef7 [ruby/io-console] Set OPOST when intr is true
To enable implementation-defined output processing, for the
compatibility with readline.  [Bug #16509]

https://bugs.ruby-lang.org/issues/16509

8c8b0b6757
2020-01-18 00:15:02 +09:00
Nobuyoshi Nakada
31e2f03512 [ruby/io-console] Enable only interrupt bits on intr: true
baaf929041
2019-12-29 16:26:22 +09:00
Nobuyoshi Nakada
77e3078ede [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@airemix.jp>

5ce201a686
2019-12-18 10:33:05 +09:00
Yusuke Endoh
b39d5da974
[ruby/io-console] Use TCSANOW to prevent from discarding the input buffer
TCSAFLUSH discards the buffer read before the mode change, which makes
IRB ignore the buffer input immediately after invoked.  TCSANOW
preserves the buffer.

b362920182
2019-12-17 13:55:05 +09:00
Nobuyoshi Nakada
81eb2d16ef
[ruby/io-console] Disable implementation-defined special control characters
In raw mode with interrupt enabled.

e9e8e3ff17
2019-12-17 13:55:04 +09:00
Nobuyoshi Nakada
a9d17af242
[ruby/io-console] Removed dead code
a49462ed97
2019-12-17 13:55:04 +09:00
Nobuyoshi Nakada
2419b3dba6
[ruby/io-console] Suppress an unused-variable warning
ae5c72e481
2019-12-10 16:06:11 +09:00
Nobuyoshi Nakada
f9c0fe77c0
[ruby/io-console] Use rb_thread_call_without_gvl instead of the deprecated function
21338ab287
2019-12-10 16:06:11 +09:00
Nobuyoshi Nakada
09723b98f7
[ruby/io-console] Warn vtime option without intr flag
499ff3de48
2019-12-10 16:06:11 +09:00
Nobuyoshi Nakada
5a404efd29 [ruby/io-console] Fixed intr: false mode on Windows
4c172c01aa
2019-12-04 10:10:45 +09:00
Jeremy Evans
17e8a6eff4 [ruby/io-console] Remove taint support
Ruby 2.7 deprecates taint and it no longer has an effect.
The lack of taint support should not cause a problem in
previous Ruby versions.
2019-11-18 01:00:25 +02:00
Jeremy Evans
ffd0820ab3 Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
2019-11-18 01:00:25 +02:00
Jeremy Evans
c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
Nobuyoshi Nakada
5357ceb1ca
[ruby/io-console] Defer creating VT query string
3d69c577a4
2019-09-26 09:59:27 +09:00
Nobuyoshi Nakada
9b10698705
[ruby/io-console] Added IO#console_mode
77ed8d5a06
2019-09-26 09:59:27 +09:00
Kazuhiro NISHIYAMA
ca58e83400
Do not use of non-standard escape character '\e' 2019-09-25 09:48:44 +09:00
Nobuyoshi Nakada
10e3267c31 [ruby/io-console] Made cursor position 0-origin
9377e37295
2019-09-24 16:20:31 +09:00
Nobuyoshi Nakada
244f7ec204 [ruby/io-console] Made cursor position consistent with winsize
To be consistent with `winsize`, changed the cursor position
format from `[x, y]` to `[row, column]`.

d1f5ae9286
2019-09-24 16:20:30 +09:00
Nobuyoshi Nakada
9e4be78ea8 [ruby/io-console] Try fallback to stdout when stdin
b8017509ef
2019-09-23 19:29:36 +09:00
Nobuyoshi Nakada
8487193b10 [ruby/io-console] Try to write DSR query to writable IO
a54b6e4dd1
2019-09-23 19:24:43 +09:00
Nobuyoshi Nakada
6d2dcf9632 [ruby/io-console] Added intr: option to IO#raw
Enters raw-mode but enable interrupts.

7cba76561a
2019-09-14 23:27:53 +09:00
Nobuyoshi Nakada
83ef58f264 [ruby/io-console] Suppress yet another warning on Windows
4e17c90788
2019-09-10 17:29:11 +09:00
Nobuyoshi Nakada
b5ab918d0c [ruby/io-console] Suppress warnings on Windows
About unused variables and a function.

32baf54e7a
2019-09-10 17:29:09 +09:00
Nobuyoshi Nakada
3678c37119 [ruby/io-console] Added IO#check_winsize_changed on Windows
ee648fa8bb
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada
74790e2dc4 [ruby/io-console] Added scroll methods
83e70de8ab
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada
c1412bd6d9 [ruby/io-console] Added line/screen erase methods
e6344108a1
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada
9844a349bf [ruby/io-console] Added IO#goto_column
143a9d5764
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada
e8be056af9 [ruby/io-console] Added relative cursor move methods
21d340e4a2
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada
3d9c7c2835 [ruby/io-console] Added IO#goto and IO#cursor= for VT
7f2b1b473d
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada
53ed4fb376 [ruby/io-console] Added IO#cursor for VT
41a6a6cace
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada
803dc9e1e4 [ruby/io-console] Added console_vt_response
A function to query console info.

db75a07fa3
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada
214e2f93aa
Fix the warning in 456586bb23 2019-05-15 18:19:23 +09:00
Nobuyoshi Nakada
29dde62605
io/console: rb_str_cat_conv_enc_opts is not exported 2019-05-14 14:50:21 +09:00
Nobuyoshi Nakada
c174670823
io/console: fix up timeout on Windows 2019-05-14 14:39:08 +09:00
Nobuyoshi Nakada
456586bb23
io/console: support getch timeout on Windows 2019-05-14 14:21:46 +09:00
Nobuyoshi Nakada
6d733565c2
io/console: support wide character input on Windows 2019-05-14 14:20:09 +09:00
nobu
1de78c5fd8 io/console: drop 2.1.0 support [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02 11:24:29 +00:00
nobu
013016b986 io/console: drop 2.0.0 support [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-02 07:53:27 +00:00
knu
b0c719dae4 Fix typos in rdoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-08 03:57:54 +00:00
knu
f477851bb7 Add details on the min/time parameters to the rdoc
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-07 05:28:14 +00:00
nobu
65b11a04f1 console.c: set winsize on Windows
* ext/io/console/console.c (console_set_winsize): retry shrinking
  window and screen buffer.  [ruby-core:82741] [Bug #13888]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-11 20:10:34 +00:00
nobu
b4a55c1cad console.c: unpaired size
* ext/io/console/console.c (console_set_winsize): reject unpaired
  pixel size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-07 23:02:29 +00:00
nobu
5b856ee1a6 console.c: OOB access
* ext/io/console/console.c (console_set_winsize): fix
  out-of-bounds access.  [ruby-core:79004] [Bug #13112]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-07 22:52:03 +00:00
nobu
e78beed499 io/console: unknown key code for names with nul
* ext/io/console/console.c (console_key_pressed_p): raise the same
  exception, "unknown virtual key code", for names with nul chars.
  though console_win32_vk() considers the length and can deal with
  nul chars, rb_sprintf() raised at PRIsVALUE previously, so quote
  it if it is unprintable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 01:07:14 +00:00
nobu
9816f87815 io/console: rb_sym2str
* ext/io/console/console.c (rb_sym2str): fallback definition for
  older ruby.  [ruby-core:74953] [Bug #12284]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 00:02:59 +00:00
nobu
cc91082af8 io/console: use rb_funcallv
* ext/io/console/console.c: use rb_funcallv instead of
  rb_funcall2, and define rb_funcallv if unavailable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 00:02:43 +00:00