Commit graph

24 commits

Author SHA1 Message Date
tomoya ishida
8088c88d01
[ruby/reline] Handle INT signal correctly, remove handle_cleared
because clear(C-l) is not a signal
(https://github.com/ruby/reline/pull/646)

3debb0ae2f
2024-04-04 17:18:47 +09:00
Stan Lo
5f334b67d2 [ruby/reline] Remove useless tests
(https://github.com/ruby/reline/pull/665)

The pasting tests hadn't been working since as early as v0.2.0. Since
what it tried to cover is already gone for such a long time, I think it's
better to write new ones if needed then to keep them around.

And since these tests are gone, the helper methods for just them are also gone.

0eedf0e4a0
2024-03-25 11:06:39 +00:00
tomoya ishida
3adaba0e81 [ruby/reline] Do not send color reset sequence when GeneralIO is
used
(https://github.com/ruby/reline/pull/661)

3719702808
2024-03-23 23:00:21 +00:00
tomoya ishida
d7bc6f0eff [ruby/reline] Reline 0.5.0.pre
(https://github.com/ruby/reline/pull/614)

* Re-architecture LineEditor's internal state and rendering

* Fix test related to LineEditor re-architecture

* Bump to 0.5.0.pre.1

* Hide cursor only when updating screen. Frequent hide&show makes cursor flickering.

* Simplify rerender call from reline.rb

* Simplify handle_cleared

It only need to clear screen. line_editor.rerender will be called later.

* Add description of updating pasting_state inserts continuous_insertion_buffer

* Use meaningful block parameter

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

* Fix use of `@cursor_y`

Fix bug updating `@cursor_y`. Do not use `@cursor_y` while updating dialog because it is not current cursor position but cursor position at last rendered time.

* Remove useless instance_variable_set in test

These instance variables are already removed from LineEditor

* Always initialize instance variables to avoid ruby 2.7 warning, remove unused instance variable

* Call update_dialogs from reline.rb before first render

* Combine state representing rendered screen information into `@rendered_screen`

* Rename editor_cursor_ to wrapped_cursor

It represents cursor position of word wrapped whole content

* Remove unused code, tweak, add comment

---------

3fa376217d

Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-03-19 14:17:26 +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
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
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
Hiroshi SHIBATA
7ff50ee35c [ruby/reline] Added some of abstruct methods for cursor
f5fa30d595
2022-09-02 16:09:50 +09:00
Samuel Williams
b5c4570af4 [ruby/reline] Prefer wait_readable for fiber scheduler.
06b4aa31fd
2021-12-11 14:29:20 +09:00
aycabta
ba0464e0cf Reline::GeneralIO should work fine without tty 2021-09-01 17:29:01 +09:00
Jeremy Evans
242bad9a87 [ruby/reline] Fix Reline::Unicode.calculate_width when input is not a TTY
This fixes an error when output is redirected:

```
$ run_ruby -rreline -e '$stderr.puts Reline::Unicode.calculate_width("\u221a").inspect' </dev/null >/dev/null
/home/jeremy/tmp/ruby/lib/reline/ansi.rb:189:in `raw': Operation not supported by device (Errno::ENODEV)
```

The @@encoding -> defined?(@@encoding) changes is necessary because
without that part of the commit, the following error would be raised
by the above command:

```
/home/jeremy/tmp/reline/lib/reline/general_io.rb:10:in `encoding': uninitialized class variable @@encoding in Reline::GeneralIO (NameError)
```

Problem reported and initial patch for Windows provided by
Richard Sharman.

I tested this only on OpenBSD, but hopefully it works for other
operating systems.

Fixes [Bug #17493]

c001971bb3
2021-06-21 17:58:48 +09:00
aycabta
b0cc46b484 [ruby/reline] The config file must accept any character encoding
In Japan, so many programmers used EUC-JP to write text files that contain
Japanese. Many .inputrc files which contain EUC-JP are still being copied and
used. This commit supports the whole encoding of what user set including UTF-8.

ref. https://github.com/ruby/reline/pull/280

0b45022e16
2021-06-21 17:58:48 +09:00
aycabta
5543695a19
[ruby/reline] Separate keystrokes each editing mode
ee23e6f3f8
2021-04-08 21:41:00 +09:00
aycabta
9750c27afc [ruby/reline] Call process_insert when the end of pasting plural fullwidth chars
594484d9f9
2020-12-05 02:58:58 +09:00
aycabta
55cc397a87 [ruby/reline] Suppress callbacks in pasting
IRB uses Reline's 3 dynamic real-time callbacks with calling Ripper;
output_modifier_proc, prompt_proc, and auto_indent_proc. These processing
times make the paste time too long.

beec3399a8
2020-12-05 02:58:58 +09:00
aycabta
06c37fa5b4 [ruby/reline] Bypass cursor down when a char is rendered at eol on Windows
A newline is automatically inserted if a character is rendered at eol on
Windows command prompt.

4bfea07e4a
2020-02-02 03:28:20 +09:00
aycabta
c257d81186 Always use UTF-8 for Reline::GeneralIO on Windows 2020-01-26 12:57:13 +09:00
aycabta
f8ea2860b0 Introduce an abstracted structure about the encoding of Reline
The command prompt on Windows always uses Unicode to take input and print
output but most Reline implementation depends on Encoding.default_external.
This commit introduces an abstracted structure about the encoding of Reline.
2020-01-14 15:40:38 +09:00
aycabta
53c05a6cf4 Remove freeze 2019-10-18 02:54:20 +09:00
aycabta
893900dc78 Add stub set_screen_size for other platforms 2019-08-29 15:21:00 +09:00
aycabta
7df65ef676 Use inputrc data for keystroke setting 2019-06-01 09:06:27 +09:00
Nobuyoshi Nakada
552c42f51f
Seprate raw keystroke config for each platforms 2019-06-01 00:41:17 +09:00
aycabta
eb4e774711 Support Meta key in Reline 2019-05-24 23:38:40 +09:00
aycabta
0f45bd0584 Split namespace of env-dependent I/O classes 2019-05-13 00:22:27 +09:00