Commit graph

694 commits

Author SHA1 Message Date
Masato Nakamura
c166615837 [ruby/reline] Add metadata for rubygems.org
(https://github.com/ruby/reline/pull/638)

d3a324d22c
2024-01-28 12:38:55 +00:00
Stan Lo
99933751c1 [ruby/reline] Bump version to v0.4.2
(https://github.com/ruby/reline/pull/633)

5b59e48070
2024-01-05 14:32:18 +00:00
tomoya ishida
542011ff68 [ruby/reline] Fix pasting tab-indented code crash
(https://github.com/ruby/reline/pull/630)

90155fd0d9
2024-01-04 11:53:06 +00:00
tomoya ishida
6f33e3c53d [ruby/reline] Revert kill_ring.rb file permission
(https://github.com/ruby/reline/pull/623)

38e9cb2899
2023-12-29 08:23:28 +00:00
Alexander Momchilov
bc3b9356b2 [ruby/reline] Replace object_id comparison with equal?
(https://github.com/ruby/reline/pull/617)

63deef4ae5
2023-12-29 04:05:28 +00:00
ima1zumi
20fbdae5fe [ruby/reline] Bump version to 0.4.1
(https://github.com/ruby/reline/pull/612)

8937279e0f
2023-12-16 13:47:04 +08: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

090e1e4df0
2023-11-13 12:42:31 +00:00
ima1zumi
e8ef010a81 [ruby/reline] Bump version to 0.4.0
(https://github.com/ruby/reline/pull/601)

d15ab72d4f
2023-11-07 15:38:53 +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>

---------

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
ima1zumi
5dfbf1a381 [ruby/reline] Bump version to 0.3.9
(https://github.com/ruby/reline/pull/594)

b6fb72718a
2023-10-03 15:10:59 +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

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

4d34e52d0b
2023-09-26 13:08:20 +00:00
elfham
766b06dfa3 [ruby/reline] Update to Unicode 15.1.0
(https://github.com/ruby/reline/pull/591)

c2fc1f771a
2023-09-25 14:28:21 +00:00
ima1zumi
c58561b5e3 [ruby/reline] Remove ARGV.first in east_asian_width.rb
(https://github.com/ruby/reline/pull/587)

`ARGV.first` is the name of the EastAsianWidth file and is not needed for east_asian_width.rb

6649bda31c
2023-08-29 17:55:02 +00:00
elfham
95efdef3b2 [ruby/reline] Set EastAsianWidth::UNICODE_VERSION
(https://github.com/ruby/reline/pull/586)

* Set EastAsianWidth::UNICODE_VERSION

* Commented out UNICODE_VERSION in Reline::Unicode::EastAsianWidth

* Commented out UNICODE_VERSION in Reline::Unicode::EastAsianWidth

6d94f2a26a
2023-08-29 17:20:18 +00:00
Stan Lo
314ccdd60c [ruby/reline] Bump version to 0.3.8
(https://github.com/ruby/reline/pull/582)

3840d1f958
2023-08-20 17:16:22 +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.

d4f0cd3fe1
2023-08-20 10:40:55 +00:00
osyo-manga
ccca097cb5 [ruby/reline] Add kill-word and backward-kill-word keymapping
support.
(https://github.com/ruby/reline/pull/570)

Fix it
https://github.com/ruby/reline/issues/558

0f8000443e

Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-07-27 09:08:24 +00:00
Stan Lo
b201ac0bc0 [ruby/reline] Bump version to 0.3.7
(https://github.com/ruby/reline/pull/578)

dc5a1b7c48
2023-07-27 08:23:08 +00:00
Stan Lo
377639053d [ruby/reline] Avoid using CSI # S for scroll down
(https://github.com/ruby/reline/pull/577)

b67ee4e791
2023-07-25 09:39:58 +00:00
tomoya ishida
ca561480ea [ruby/reline] Always set ANSI CSI keybindings for Home, End, and
Arrow.
(https://github.com/ruby/reline/pull/569)

f363a43a45
2023-07-19 13:25:58 +00:00
osyo-manga
45fd006185 [ruby/reline] Fix [nil] is passed to auto_indent_proc when exit with
CTRL+d
(https://github.com/ruby/reline/pull/571)

* Fix [nil] is passed to auto_indent_proc when exit with CTRL+d

Fix it https://github.com/ruby/reline/issues/556

* not call auto_indent_proc when Ctrl+d.

see: https://github.com/ruby/reline/pull/571#issuecomment-1637183195

0924f2a075
2023-07-18 20:33:39 +00:00
Stan Lo
33e00b79a0 [ruby/reline] Bump version to 0.3.6
(https://github.com/ruby/reline/pull/565)

2503ddb9a6
2023-07-08 08:53:46 +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
cd7166cc8f [ruby/reline] Fix wrong byte_pointer passed to auto_indent_proc
(https://github.com/ruby/reline/pull/562)

4348354604
2023-07-05 16:33:46 +00:00
ima1zumi
218a8d8ef1 [ruby/reline] Remove unused method
(https://github.com/ruby/reline/pull/557)

`get_mbchar_byte_size_by_first_char` isn't used in Reline.
Also, this method implements the same functionality as `String#bytesize` and is unnecessary.
2023-06-22 17:07:23 +00:00
Yuta Kusuno
9ce6e09637 [ruby/reline] Omit constant under Struct
(https://github.com/ruby/reline/pull/554)

8761a11fa5
2023-06-20 14:02:58 +00:00
Stan Lo
e6bd1852fb [ruby/reline] Bump version to 0.3.5
(https://github.com/ruby/reline/pull/548)

4330a52572
2023-06-03 08:28:02 +00:00
Nobuyoshi Nakada
e38fb050fa [ruby/reline] Remove unnecessary conditions for
`Fiddle::TYPE_VARIADIC`
(https://github.com/ruby/reline/pull/547)

71ba3a9432
2023-06-02 12:18:06 +00:00
tomoya ishida
cf0b9e0db0 [ruby/reline] Fix scrolldown condition in dialog rendering
(https://github.com/ruby/reline/pull/541)

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
ima1zumi
8db13c179e [ruby/reline] Bump version to 0.3.4
(https://github.com/ruby/reline/pull/538)

1fb0753bc1
2023-05-20 09:31:43 +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>

---------

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
Carl Brasic
8a132358d7 [ruby/reline] Revert #335 (Trap TSTP to handle C-z)
(https://github.com/ruby/reline/pull/535)

This PR was an effort to address #321 (ed_quoted_insert doesn't work
properly) but per the reporter it did not work correctly.

Moreover, it introduced a major regression: Shell job control stopped
working in all applications that use reline, notably IRB.

Bash and other shells send SIGTSTP in response to C-z to implement job
suspension. Handling SIGSTP opts out of this functionality. For a
line oriented terminal program this should be avoided (not to mention,
this behavior diverges from readline's)

26383d25b8

Co-authored-by: Carl Brasic <cbrasic@drwholdings.com>
2023-04-24 16:31:13 +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
Stan Lo
b168141c78 [ruby/reline] Drop Dialog#scrollbar_pos as we can store it in a
local variable
(https://github.com/ruby/reline/pull/529)

d0139975fd

Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com>
2023-03-29 13:51:27 +00:00
Stan Lo
02ecdf85c5 [ruby/reline] Drop Unicode.take_range's optional arg as it's never
used
(https://github.com/ruby/reline/pull/528)

428fed4a6a
2023-03-29 10:20:29 +00: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)

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
ima1zumi
ec14b381c1 [ruby/reline] Bump version to 0.3.3
(https://github.com/ruby/reline/pull/525)

8ce176271f
2023-03-27 15:14:56 +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>

---------

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)

ae5f9b87ab
2023-03-18 14:37:10 +00:00
tomoya ishida
6f81e38d1d [ruby/reline] Fix completion with multiline
(https://github.com/ruby/reline/pull/513)

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
7d61b3df9a
2023-02-06 14:23:59 +00:00