character attributes
(https://github.com/ruby/reline/pull/552)
* Reine::Face
* fix test_yamatanooroti
* Define singleton methods to make accessors to attributes of a face
* s/display/foreground/
* s/default/default_style/ && s/normal_line/default/ && s/enhanced_line/enhanced/
* fix typo
* FaceConfig.new now takes keyword arguments
* Update lib/reline/face.rb
Co-authored-by: Stan Lo <stan001212@gmail.com>
* Update test/reline/test_face.rb
Co-authored-by: Stan Lo <stan001212@gmail.com>
* Fix to correspond to frozen_string_literal
* Face::FaceConfig -> Face::Config
* ref https://github.com/ruby/reline/pull/552#pullrequestreview-1677282576
* delete unused ivar
* ref https://github.com/ruby/reline/pull/552#discussion_r1358783723
* insert "\e[0m" into all SGR
* tiny fix
* ESSENTIAL_DEFINE_NAMES
ref https://github.com/ruby/reline/pull/552#discussion_r1367722247
* Change to Hash-accessor style
- Reline::Face[:completion_dialog].enhanced ->
Reline::Face[:completion_dialog][:enhanced]
- Reline::Face.configs shows all defined values
* Cache array method call in local variable
* Tests for Face configuration variations
* resolve https://github.com/ruby/reline/pull/552#pullrequestreview-1710938154
* amend to
* check invalid SGR parameter in :style
* The order of define values should be preserved
* Update test/reline/test_face.rb
Co-authored-by: Stan Lo <stan001212@gmail.com>
* Update test/reline/test_face.rb
Co-authored-by: Stan Lo <stan001212@gmail.com>
* Add methods: load_initial_config and reset_to_initial_config. And teardown in tests
* omission in amending "style: :default" to "style: :reset"
* refs https://github.com/ruby/reline/issues/598
* Fix link
* amend method name
* Update lib/reline/face.rb
Co-authored-by: ima1zumi <52617472+ima1zumi@users.noreply.github.com>
---------
https://github.com/ruby/reline/commit/fdc1d3b1e5
Co-authored-by: Stan Lo <stan001212@gmail.com>
Co-authored-by: ima1zumi <52617472+ima1zumi@users.noreply.github.com>
(https://github.com/ruby/reline/pull/566)
* Avoid referencing IOGate from IOGate classes
The only time those classes being used is when themselves being the IOGate.
So when referencing to IOGate, it's better to use `self` instead.
* Avoid referencing to IOGate from LineEditor directly
* Avoid referencing to IOGate from Core directly
* Reference to Reline.core directly
* Replace Reline::IOGate with Reline.core.io_gate
duplicated line.
(https://github.com/ruby/reline/pull/460)
* whole_lines should consider prev_line_index, and must not duplicate last_line
* Add test for lines passed to dynamic prompt proc
* Refactor whole_lines parameters used in test helper
* Remove whole_line's arguments
Fixes the same issue at https://github.com/ruby/ruby/pull/5417
`ruby` is not always available in certain build environments and
configure options (e.g. --program-suffix)
This patch tries to choose an appropriate command line for spawning a
fresh Ruby process, based on EnvUtil implementation in ruby/ruby's test
suite.
Plus when this library is directly mirrored into ruby/ruby, prefer EnvUtil
available there over the implementation in this library's test suite.
https://github.com/ruby/reline/commit/278327d2e9
The method "input_keys" in test/reline/helper.rb handles a single-byte
and 8-bit charater as an input with the meta key.
However, "test_halfwidth_kana_width_dakuten" in test/reline/test_key_actor_emacs.rb
uses a string that contains "hankaku" characters.
A "hankaku" character is not with the meta key, but it is a single-byte
and 8-bit character on Windows-31J encoding, which confused "input_keys"
method. This caused the following error.
https://ci.appveyor.com/project/ruby/ruby/builds/41997092/job/ejm77qxgvnlpdwvg
```
1) Failure:
Reline::KeyActor::Emacs::Test#test_halfwidth_kana_width_dakuten [C:/projects/ruby/test/reline/test_key_actor_emacs.rb:2311]:
<"\xB6\xDE\xB7\xDE\xB9\xDE\xBA\xDE" (#<Encoding:Windows-31J>)> expected but was
<"\e^\e^\e^\e:\e^" (#<Encoding:Windows-31J>)> in <Terminal #<Encoding:Windows-31J>>
.
<8> expected but was
<10>.
Finished tests in 1045.472722s, 19.3922 tests/s, 2609.4320 assertions/s.
```
This change introduces "input_raw_keys" that does not convert a
single-byte and 8-bit character to "with the meta key", and use it in
the test in question.
https://github.com/ruby/reline/commit/f6ae0e5d19
Cfuncs that use rb_scan_args with the : entry suffer similar keyword
argument separation issues that Ruby methods suffer if the cfuncs
accept optional or variable arguments.
This makes the following changes to : handling.
* Treats as **kw, prompting keyword argument separation warnings
if called with a positional hash.
* Do not look for an option hash if empty keywords are provided.
For backwards compatibility, treat an empty keyword splat as a empty
mandatory positional hash argument, but emit a a warning, as this
behavior will be removed in Ruby 3. The argument number check
needs to be moved lower so it can correctly handle an empty
positional argument being added.
* If the last argument is nil and it is necessary to treat it as an option
hash in order to make sure all arguments are processed, continue to
treat the last argument as the option hash. Emit a warning in this case,
as this behavior will be removed in Ruby 3.
* If splitting the keyword hash into two hashes, issue a warning, as we
will not be splitting hashes in Ruby 3.
* If the keyword argument is required to fill a mandatory positional
argument, continue to do so, but emit a warning as this behavior will
be going away in Ruby 3.
* If keyword arguments are provided and the last argument is not a hash,
that indicates something wrong. This can happen if a cfunc is calling
rb_scan_args multiple times, and providing arguments that were not
passed to it from Ruby. Callers need to switch to the new
rb_scan_args_kw function, which allows passing of whether keywords
were provided.
This commit fixes all warnings caused by the changes above.
It switches some function calls to *_kw versions with appropriate
kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS
is used. If creating new arguments, RB_PASS_KEYWORDS is used if
the last argument is a hash to be treated as keywords.
In open_key_args in io.c, use rb_scan_args_kw.
In this case, the arguments provided come from another C
function, not Ruby. The last argument may or may not be a hash,
so we can't set keyword argument mode. However, if it is a
hash, we don't want to warn when treating it as keywords.
In Ruby files, make sure to appropriately use keyword splats
or literal keywords when calling Cfuncs that now issue keyword
argument separation warnings through rb_scan_args. Also, make
sure not to pass nil in place of an option hash.
Work around Kernel#warn warnings due to problems in the Rubygems
override of the method. There is an open pull request to fix
these issues in Rubygems, but part of the Rubygems tests for
their override fail on ruby-head due to rb_scan_args not
recognizing empty keyword splats, which this commit fixes.
Implementation wise, adding rb_scan_args_kw is kind of a pain,
because rb_scan_args takes a variable number of arguments.
In order to not duplicate all the code, the function internals need
to be split into two functions taking a va_list, and to avoid passing
in a ton of arguments, a single struct argument is used to handle
the variables previously local to the function.
* lib/reine.rb, lib/reline/*: Reline is a readline stdlib compatible
library.
* lib/readline.rb: Readline uses a fallback to Reline when ext/readline
doesn't exist.
* tool/sync_default_gems.rb: add ruby/reline as a default gem.
* appveyor.yml: add "set RELINE_TEST_ENCODING=Windows-31J" for test suit
of Reline, and add "--exclude readline" to "nmake test-all" on Visual
Studio builds because of strange behavior.
* spec/ruby/library/readline/spec_helper.rb: skip Reline as with
RbReadline.
Reline is a readline stdlib compatible library. It also supports
multiline input. IRB is improved with Reline and supports multiline.
Besides, supports showing documents when completed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e