Commit graph

152 commits

Author SHA1 Message Date
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
nobu
c88d0666d4 io/console: fallback RARRAY_CONST_PTR
* ext/io/console/console.c (RARRAY_CONST_PTR): fallback definition
  for older ruby.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 00:02:42 +00:00
nobu
0177687124 io/console: reject symbols with nul char
* ext/io/console/console.c (console_key_pressed_p): symbol names
  can contain nul chars, reject them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-15 00:02:41 +00:00
nobu
f4166e2dd7 prefer rb_syserr_fail
* file.c, io.c, util.c: prefer rb_syserr_fail with saved errno
  over setting errno then call rb_sys_fail, not to be clobbered
  potentially and to reduce thread local errno accesses.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23 08:57:48 +00:00
nobu
8f620b9b17 retry IO#getpass
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 13:26:56 +00:00
naruse
958e153cdb Revert r52902,r52903,r52910,r52911,r52937,r52939
Reject IO::Console#getpass because it can't test portablly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 10:54:42 +00:00
nobu
1ad0d8ecad console.c: prompt to stderr
* ext/io/console/console.c (console_getpass): print prompt to
  stderr when reading from stdin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-06 06:30:11 +00:00
nobu
187de9240a console.c: console_getpass
* ext/io/console/console.c (console_getpass): add IO#getpass
  method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-06 06:25:10 +00:00
nobu
9d0012b0e7 console.c: check unused args
* ext/io/console/console.c (console_set_winsize): unused arguments
  also should be nil or integers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-07 00:25:50 +00:00