Граф коммитов

354 Коммитов

Автор SHA1 Сообщение Дата
Otávio Schwanck dos Santos e848848b58
[ruby/reline] C for vi mode
(https://github.com/ruby/reline/pull/472)

https://github.com/ruby/reline/commit/d197be7c44
2024-02-13 18:57:17 +09:00
tomoya ishida 542011ff68 [ruby/reline] Fix pasting tab-indented code crash
(https://github.com/ruby/reline/pull/630)

https://github.com/ruby/reline/commit/90155fd0d9
2024-01-04 11:53:06 +00:00
tomoya ishida 90b49024c0 [ruby/reline] Fallback to 256color if COLORTERM != truecolor
(https://github.com/ruby/reline/pull/604)

* Fallback to 256color if COLORTERM != truecolor

* Add Reline::Face.force_truecolor to force truecolor without COLORTERM env

https://github.com/ruby/reline/commit/090e1e4df0
2023-11-13 12:42:31 +00:00
Stan Lo 2dd32e7c3b [ruby/reline] Test Reline::Face without mocking
(https://github.com/ruby/reline/pull/600)

* Test Reline::Face without mocking

Because `test-unit-rr` is not a default gem, using it would break CRuby's
CI.

* Add ruby-core workflow

https://github.com/ruby/reline/commit/d2189ac436
2023-11-06 15:53:38 +00:00
HASUMI Hitoshi 16403f41ab [ruby/reline] Introduce a new class Reline::Face to configure
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>
2023-11-06 14:40:42 +00:00
tomoya ishida d4942546af [ruby/reline] Properly restore Reline::IOGate in test teardown
(https://github.com/ruby/reline/pull/593)

* Properly restore Reline::IOGate in test teardown

* GeneralIO.reset should reset class variable existence

https://github.com/ruby/reline/commit/c16d33dae5
2023-09-28 13:53:30 +00:00
elfham 3f1cfc43bd [ruby/reline] Fix config.rb to File.expand_path $include path in
inputrc
(https://github.com/ruby/reline/pull/592)

* Fix config.rb to File.expand_path $include path in inputrc

* fix bug of test_include_expand_path on Windows

https://github.com/ruby/reline/commit/4d34e52d0b
2023-09-26 13:08:20 +00:00
Stan Lo 7c226291d3 [ruby/reline] Remove Timeout usage
(https://github.com/ruby/reline/pull/580)

Timeout's implementation relies on Thread, which would conflict with
`ruby/debug`'s thread-freezing implementation and has casued issues like

- ruby/debug#877
- ruby/debug#934
- ruby/debug#1000

This commit avoids the issue by completely removing the use of Timeout.

https://github.com/ruby/reline/commit/d4f0cd3fe1
2023-08-20 10:40:55 +00:00
tomoya ishida 7380c73af4 [ruby/reline] Add assertion to auto_indent_proc's parameter, add
Ctrl-d exit test
(https://github.com/ruby/reline/pull/574)

* Add auto_indent_proc's parameter assertion in multiline_repl

* Add rendering test for Ctrl-d exit

https://github.com/ruby/reline/commit/46db71132a
2023-07-19 13:31:17 +00:00
tomoya ishida ca561480ea [ruby/reline] Always set ANSI CSI keybindings for Home, End, and
Arrow.
(https://github.com/ruby/reline/pull/569)

https://github.com/ruby/reline/commit/f363a43a45
2023-07-19 13:25:58 +00:00
tomoya ishida b400307923 [ruby/reline] Add missing `close` to test_rendering.rb
(https://github.com/ruby/reline/pull/573)

https://github.com/ruby/reline/commit/7cd817036e
2023-07-18 20:31:40 +00:00
tomoya ishida 02f9b685e8 [ruby/reline] Ignore unhandled escape sequences
(https://github.com/ruby/reline/pull/522)

* Add unassigned escape sequence matcher to KeyStroke

* Do not insert ESC and unassigned ESC+key to input buffer
2023-07-08 08:41:30 +00:00
Stan Lo 24d9e21f84 [ruby/reline] Reduce direct references to `Reline::IOGate`
(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
2023-07-07 17:27:25 +00:00
tomoya ishida 6f9d1b4b0f [ruby/reline] Update Relin::IOGate dinamically when it is needed
(https://github.com/ruby/reline/pull/560)

https://github.com/ruby/reline/commit/4680d1c9e0
2023-07-05 20:21:13 +00:00
tomoya ishida cd7166cc8f [ruby/reline] Fix wrong byte_pointer passed to auto_indent_proc
(https://github.com/ruby/reline/pull/562)

https://github.com/ruby/reline/commit/4348354604
2023-07-05 16:33:46 +00:00
tomoya ishida cf0b9e0db0 [ruby/reline] Fix scrolldown condition in dialog rendering
(https://github.com/ruby/reline/pull/541)

https://github.com/ruby/reline/commit/ad6faada3f
2023-05-27 15:07:29 +00:00
tomoya ishida 5d137a7f77 [ruby/reline] Use appropriate dialog height and reduce screen pushup
problem
(https://github.com/ruby/reline/pull/542)

* Provide preferred_dialog_height for dialog positioning

* Fix rendering test
2023-05-27 14:48:50 +00:00
tomoya ishida 5eca327fc5 [ruby/reline] Fix dialog corrupts rendering by pushing up input line
too much
(https://github.com/ruby/reline/pull/524)

* Do not render dialog where it overflows screen

* Dialog rendering should Scroll down only when needed

* Refactor screen_y_range calculation

Co-authored-by: Stan Lo <stan001212@gmail.com>

---------

https://github.com/ruby/reline/commit/bc0e3d1310

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-05-07 13:18:13 +00:00
tomoya ishida 13dfbcf7bf [ruby/reline] Rewrite dialog rendering
(https://github.com/ruby/reline/pull/492)

* Rewrite dialog rendering

* Fix failing test of dialog with small screen

* Add multiple-dialog rendering test

* Add description comments for each part of render_dialog_changes
2023-05-01 12:20:20 +00:00
tomoya ishida 19aa30d5d5 [ruby/reline] Change Reline.add_dialog_proc(name, nil) to properly
remove dialog_proc
(https://github.com/ruby/reline/pull/532)

https://github.com/ruby/reline/commit/43283b2f37
2023-04-15 09:32:05 +00:00
Étienne Barrié 52ff2ce9da
Use `em_delete` in `key_delete` (#504)
* Test existing behavior

Typing Ctrl-D ends editing but typing <Del> does not.

Also renamed a test that is not testing ed_delete_next_char but
key_delete.

* Check if line empty first in em_delete

By distributivity of AND over OR, we can factor out this condition. This
will make the next commit simpler.

* Use em_delete in key_delete

When the editing mode is emacs, use `em_delete` in `key_delete`. We need
to add a condition though to `em_delete`, because it implements both
`delete-char` and `end-of-file`. We only want the `end-of-file` behavior
is the key is really Ctrl-D.

This matches the behavior of the <Del> key with readline, i.e. deleting
the next character if there is one, but not moving the cursor, while not
finishing the editing if there are no characters.
2023-04-05 08:59:12 +09:00
tomoya ishida e26908dc4b [ruby/reline] Improve OSC sequence regexp. OSC sequence can end with
ST(ESC\) and it should not to include \a and \e inside.
(https://github.com/ruby/reline/pull/527)

https://github.com/ruby/reline/commit/a88052adec
2023-03-29 06:54:08 +00:00
Stan Lo 1e9a218ade [ruby/reline] Expand the scanned array to later case statement more
straightforward
(https://github.com/ruby/reline/pull/526)

* Improve test coverage on Unicode.take_range

* Add test for Unicode.calculate_width

* Expand the scanned array to later case statement more straightforward
2023-03-28 12:49:49 +00:00
tomoya ishida 8f569d41cb [ruby/reline] Fix cursor position overrun
(https://github.com/ruby/reline/pull/515)

* Fix cursor position overrun

* Remove unnecessary local variable

Co-authored-by: Stan Lo <stan001212@gmail.com>

---------

https://github.com/ruby/reline/commit/d4ad9b96c8

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-03-27 13:57:16 +00:00
tomoya ishida 60ca800d4f [ruby/reline] Fix split_by_width to retain color sequences
(https://github.com/ruby/reline/pull/490)

* Fix split_by_width to retain color sequences

* Add OSC escape sequence testcase of Reline::Unicode.split_by_width
2023-03-25 15:01:35 +00:00
Phillip Hellewell f67f0d7268 [ruby/reline] Add key bindings for PgUp and PgDn
(https://github.com/ruby/reline/pull/509)

* Add key bindings for PgUp, PgDn

* Match behavior of readline 8.2

In the latest readline (8.2), page-up and page-down are bound to
history-search-backward and history-search-forward by default.

We would like reline to have the same default behavior.
2023-03-21 14:48:32 +00:00
tomoya ishida e8e7ff1333 [ruby/reline] Fix: line longer than terminal width breaks rendering
(https://github.com/ruby/reline/pull/516)

https://github.com/ruby/reline/commit/ae5f9b87ab
2023-03-18 14:37:10 +00:00
Takashi Kokubun 2e875549a9 s/MJIT/RJIT/ 2023-03-06 23:44:01 -08:00
tomoya ishida 6f81e38d1d [ruby/reline] Fix completion with multiline
(https://github.com/ruby/reline/pull/513)

https://github.com/ruby/reline/commit/d76c482c5f
2023-03-04 05:56:00 +00:00
tomoya ishida 4f611df3f7 [ruby/reline] Fix wrong indent number in prompt. whole_lines has
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
2023-02-27 10:21:30 +00:00
tomoya ishida 92ed8e6f3f [ruby/reline] Fix the cause of test_yamatanooroti randomly failing
(https://github.com/ruby/reline/pull/474)

* Add repeated input-delete test that fails on HEAD

* Use raw mode while readmultiline
2023-02-27 08:44:02 +00:00
tompng 91f353b1c3 [ruby/reline] Fix line rendering when newline is added at the end of the buffer
https://github.com/ruby/reline/commit/7d61b3df9a
2023-02-06 14:23:59 +00:00
Sorah Fukumori 8a29419b7f [ruby/reline] test_dumb_terminal: "ruby" command is not always available
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
2023-02-05 20:31:37 +00:00
tompng 76e3d853ab [ruby/reline] Add autoindent test for indent after bracket and newline
https://github.com/ruby/reline/commit/3f3da7d0e2
2023-01-20 13:40:16 +00:00
tompng 976d72a9f5 [ruby/reline] Add scrollbar scroll-to-bottom test and fix existing scrollbar rendeing test
https://github.com/ruby/reline/commit/268e02b155
2023-01-18 14:49:28 +00:00
tomoya ishida 2d7e639549 [ruby/reline] multiline_repl do not need to depend on RubyLex
(https://github.com/ruby/reline/pull/502)

* multiline_repl do not need to depend on RubyLex

* Add auto indent test
2023-01-18 05:28:18 +00:00
HASUMI Hitoshi 5b26f76ad9 [ruby/reline] Correspond to refactored RubyLex
(https://github.com/ruby/reline/pull/498)

* Correspond to refactored RubyLex

ref: https://github.com/ruby/irb/pull/503

* Fix test_yamatanooroti
2023-01-14 09:19:41 +00:00
tomoya ishida 0abb4b6348 [ruby/reline] Pass unmodifined lines(that does not include escape
sequence) to check_multiline_prompt
(https://github.com/ruby/reline/pull/458)

* pass unmodified lines to check_multiline_prompt

* Add test to check that output modified by output_modifier_proc is not passed to prompt_proc
2023-01-12 00:14:53 +00:00
Phillip Hellewell d831b1d5ce [ruby/reline] Reset IOGate in test_reset
https://github.com/ruby/reline/commit/331c1094ef
2023-01-11 11:38:51 +00:00
Phillip Hellewell 4222083cbd [ruby/reline] Change IOGate back to GeneralIO
Staying with ANSI can cause side effects with other tests.

https://github.com/ruby/reline/commit/ba36067802
2023-01-11 11:38:50 +00:00
Phillip Hellewell 97f8f2c470 [ruby/reline] Add key binding for Delete
https://github.com/ruby/reline/commit/603eacee22
2023-01-10 12:18:14 +00:00
HASUMI Hitoshi fe3cbc61c8 [ruby/reline] Fix a misparameter of RubyLex#set_input in
termination_checker.rb
(https://github.com/ruby/reline/pull/482)

* Fix a misparameter of RubyLex#set_input in termination_checker.rb

The keyword parameter `:context` of RubyLex#set_input became mandatory due to this commit:
https://github.com/ruby/irb/pull/427/files#diff-612b926e42ed78aed1a889ac1944f7d22229b3a489cc08f837a7f75eca3d3399R51

Without my patch, tests that specify "--auto-indent" option in test_yamatanooroti fall into an infinite loop.

This would need more explanation:
- The infinite loop happens in Yamatanooroti::VTermTestCaseModule#sync
  see: https://github.com/aycabta/yamatanooroti/blob/v0.0.9/lib/yamatanooroti/vterm.rb#L60-L63
- `@pty_output.read_nonblock(1024)` actually returned an exception
- However, this method doesn't anticipate such a situation
- As a result, `startup_message` couldn't be resolved for good and the
  infinite loop happens
- I think we would eventually have to fix yamatanooroti, though the
  inconsistency of the kwarg of "set_input" has to be fixed anyway

The actual exception message that is raised but ignored silently in Yamatanooroti::VTermTestCaseModule#sync:

```
/home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/irb-d30c0c994351/lib/irb/ruby-lex.rb:51:in `set_input': missing keyword: :context (ArgumentError)
        from /home/hasumi/work/ruby/reline/test/reline/yamatanooroti/termination_checker.rb:23:in `initialize'
        from /home/hasumi/work/ruby/reline/test/reline/yamatanooroti/multiline_repl:43:in `new'
        from /home/hasumi/work/ruby/reline/test/reline/yamatanooroti/multiline_repl:43:in `block in <main>'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/optparse.rb:1576:in `block in parse_in_order'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/optparse.rb:1559:in `catch'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/optparse.rb:1559:in `parse_in_order'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/optparse.rb:1553:in `order!'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/optparse.rb:1659:in `permute!'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/optparse.rb:1684:in `parse!'
        from /home/hasumi/work/ruby/reline/test/reline/yamatanooroti/multiline_repl:174:in `<main>'
```

Backtrace of an inifinite loop:

```
/home/hasumi/work/ruby/yamatanooroti/lib/yamatanooroti/vterm.rb:59:in `sleep': Interrupt
        from /home/hasumi/work/ruby/yamatanooroti/lib/yamatanooroti/vterm.rb:59:in `block in sync'
        from /home/hasumi/work/ruby/yamatanooroti/lib/yamatanooroti/vterm.rb:58:in `loop'
        from /home/hasumi/work/ruby/yamatanooroti/lib/yamatanooroti/vterm.rb:58:in `sync'
        from /home/hasumi/work/ruby/yamatanooroti/lib/yamatanooroti/vterm.rb:28:in `start_terminal'
        from /home/hasumi/work/ruby/reline/test/reline/yamatanooroti/test_rendering.rb:653:in `test_suppress_auto_indent_just_after_pasted'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testcase.rb:871:in `run_test'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testcase.rb:566:in `block (2 levels) in run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/fixture.rb:276:in `block in create_fixtures_runner'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/fixture.rb:276:in `block in create_fixtures_runner'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/fixture.rb:257:in `run_fixture'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/fixture.rb:292:in `run_setup'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testcase.rb:564:in `block in run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testcase.rb:563:in `catch'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testcase.rb:563:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testsuite.rb:124:in `run_test'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testsuite.rb:53:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testsuite.rb:124:in `run_test'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testsuite.rb:53:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testsuite.rb:124:in `run_test'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testsuite.rb:53:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testsuite.rb:124:in `run_test'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/testsuite.rb:53:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb:67:in `run_suite'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb:45:in `block (2 levels) in run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb:102:in `with_listener'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb:41:in `block in run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb:39:in `catch'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunnermediator.rb:39:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunner.rb:40:in `start_mediator'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunner.rb:25:in `start'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/ui/testrunnerutilities.rb:24:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/autorunner.rb:458:in `block in run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/autorunner.rb:514:in `change_work_directory'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/autorunner.rb:457:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit/autorunner.rb:66:in `run'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/test-unit-3.5.5/lib/test/unit.rb:518:in `block (2 levels) in <top (required)>'
```

* Fix mock object of Context

The previous commit solved one problem, but it found the next problem.

Following error message got from the command `RELINE_STDERR_TTY=error.log rake test_yamatanooroti`:

```
Reline is used by 24373
/home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/irb-d30c0c994351/lib/irb/ruby-lex.rb:151:in `ripper_lex_without_warning': private method `local_variables' called for #<struct auto_indent_mode=true, workspace=nil> (NoMethodError)

    lvars_code = generate_local_variables_assign_code(context&.local_variables || [])
                                                             ^^^^^^^^^^^^^^^^^
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/bundler/gems/irb-d30c0c994351/lib/irb/ruby-lex.rb:213:in `block in set_auto_indent'
        from /home/hasumi/work/ruby/reline/lib/reline/line_editor.rb:1721:in `process_auto_indent'
        from /home/hasumi/work/ruby/reline/lib/reline/line_editor.rb:1663:in `input_key'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:346:in `block (3 levels) in inner_readline'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:345:in `each'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:345:in `block (2 levels) in inner_readline'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:420:in `block in read_io'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:390:in `loop'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:390:in `read_io'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:343:in `block in inner_readline'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:341:in `loop'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:341:in `inner_readline'
        from /home/hasumi/work/ruby/reline/lib/reline.rb:271:in `readmultiline'
        from /home/hasumi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/forwardable.rb:238:in `readmultiline'
        from /home/hasumi/work/ruby/reline/test/reline/yamatanooroti/multiline_repl:185:in `<main>'
```

In irb/ruby-lex.rb, `context` is originally supposed to be an instance of IRB::Context with a public method `#local_variables`.
However, the `context` in reline/test/reline/yamatanooroti/termination_checker.rb is a Struct that is a mock object with no `#local_variables` method.

Thus, `rake test_yamatanooroti` no longer causes an infinite loop and an unexpected error with these two commits (at least in WITH_VTERM environment)

* Name the Struct "MockIRBContext" to specify what it is for
2022-12-14 00:00:39 +00:00
Stan Lo 16b2e03014 [ruby/reline] Remove unapproved color setting APIs
These APIs/configs are not approved by the Ruby core, so they can't be
released to the public. This means having them in the codebase will
block other fixes/features from being released as well.

So this commit removes those exposed interfaces to unblock the release.

Hopefully when https://bugs.ruby-lang.org/issues/18996 is approved we
can re-implement better APIs.

https://github.com/ruby/reline/commit/f7a961c550
2022-12-05 03:14:55 +00:00
Otávio Schwanck dos Santos 4bdd8f2ddf [ruby/reline] use assert_nothing_raised
https://github.com/ruby/reline/commit/f08be5da09
2022-09-22 22:28:39 +09:00
Otávio Schwanck dos Santos 696e8914b7 [ruby/reline] PR changes
https://github.com/ruby/reline/commit/e8e8d81f47
2022-09-22 22:28:38 +09:00
Nobuyoshi Nakada 59e8569cf9 [ruby/reline] Support dumb terminal
The "dumb" terminal is considered only on MSys tty now.  However, the
`TERM` feature has been used on many Unix-like systems for decades,
not MSys specific.

https://github.com/ruby/reline/commit/53fd51ab62
2022-09-01 16:36:16 +09:00
st0012 b3be030740 [ruby/reline] Rename dialog_pointer_* to dialog_highlight_*
"Pointer" is not what we usually use to describe a selected item.

"Highlight" is a more common word for the scenario so we should use it instead.

https://github.com/ruby/reline/commit/b4279d1557
2022-07-22 23:34:49 +09:00
st0012 36ca0e58b6 [ruby/reline] Use color name instead of code (integer) in dialog color APIs
As pointed out in the
[comment](https://github.com/ruby/reline/pull/413#issuecomment-1168033973),
the code is actually a control sequence and not only for colors.

To make the dialog color APIs safer to use, we should restrict its
usages and extract away the bg/fg concept from the input.

So in this commit, I made these changes:

1. The dialog_*_bg/fg_color APIs only takes and returns color names (symbol):
  - :black
  - :red
  - :green
  - :yellow
  - :blue
  - :magenta
  - :cyan
  - :white
2. Add additional dialog_*_bg/fg_color_sequence APIs to access the raw code.

https://github.com/ruby/reline/commit/b32a977766
2022-07-16 02:30:23 +09:00
st0012 2733c04967 [ruby/reline] Add tests for top-level dialog color APIs
https://github.com/ruby/reline/commit/347a468c59
2022-07-11 22:19:44 +09:00
pocari 8c6c3e30f3 [ruby/reline] Enable to change the background color of dialogs. (https://github.com/ruby/reline/pull/413)
https://github.com/ruby/reline/commit/bd49537964
2022-06-27 22:28:49 +09:00