Commit graph

650 commits

Author SHA1 Message Date
aycabta
40c20110d5 [ruby/reline] Version 0.3.0
3f6ea92268
2021-12-25 10:58:44 +09:00
aycabta
c815c0be46 [ruby/reline] Escape newline(s) in dynamic prompt
9b209ee1ea
2021-12-25 00:32:58 +09:00
aycabta
b0db420b0e [ruby/reline] Escape newline(s) in prompt
b545459fca
2021-12-25 00:32:57 +09:00
aycabta
22cc2243f9 [ruby/reline] Remove unnecessary parameter
20fcd22564
2021-12-25 00:32:56 +09:00
aycabta
4fccefef05 [ruby/reline] Revert "Change aliased methods to be parivete"
Ruby 2.5 doesn't support "private alias_method" idiom  but Ruby on Rails
6.x still support 2.5. 😢

This reverts commit 0f075f562b.

4ecaa63b26
2021-12-24 18:23:28 +09:00
aycabta
fc5bc378e5 [ruby/reline] Change aliased methods to be parivete
0f075f562b
2021-12-24 18:23:28 +09:00
aycabta
a9c59b13da [ruby/reline] Add doc about em-kill-line macro
2e46493aff
2021-12-24 18:23:28 +09:00
aycabta
bad1e153d4 [ruby/reline] Implement em_kill_line
9fca6ceb45
2021-12-24 18:23:28 +09:00
aycabta
6c3cc9c58a [ruby/reline] Rename the wrong name "em-kill-line" with the correct name "unix-line-discard"
da7af35d1f
2021-12-24 18:23:28 +09:00
aycabta
fd60a235f5 [ruby/reline] Add doc about ed-kill-line, kill-line, em-kill-line, and unix-line-discard
586a48ffe0
2021-12-24 18:23:28 +09:00
aycabta
9de42d3b34 [ruby/reline] Bind ed-kill-line to C-u on emacs mode
9ab99574f5
2021-12-24 18:23:28 +09:00
aycabta
15fab6fb17 [ruby/reline] Support S-Tab to move up completion cursor in vi-mode on Unix
ff278cdc88
2021-12-24 18:23:28 +09:00
aycabta
3a59abab08 [ruby/reline] Determine 1st char or 2nd char of surrogate pair correctly
182606c847
2021-12-24 13:57:46 +09:00
aycabta
4bb65ee4fe [ruby/reline] Character merging may increase the character width
Even if the number of graphemes doesn't change owing to character
merging, the character width may increase.

fbcd5f56a7
2021-12-24 00:51:48 +09:00
aycabta
726cc8122e [ruby/reline] "Halfwidth char + halfwidth (han)dakuten" is a single grapheme.
When a halfwidth character is followed by a halfwidth dakuten or a
halfwidth handakuten character, it should be treated as a single
grapheme.

9f20b9ec28
2021-12-24 00:51:47 +09:00
aycabta
daf4a8884b [ruby/reline] Add comment for a following char of combined char
d465667f57
2021-12-24 00:51:46 +09:00
aycabta
37aea9d798 [ruby/reline] Finalize when exception occurred
1f8a3aee43

Co-authored-by: Alex Gittemeier <me@a.lexg.dev>
2021-12-21 00:49:03 +09:00
aycabta
c3a3f65b45 [ruby/reline] Split off set_signal_handler method
In some tests, the LineEditor#reset method is always called, but doesn't
need to set the signal handlers there, so cuts it out to a separate
method.

b143c4f5f9
2021-12-21 00:13:19 +09:00
aycabta
95c61c8d82 [ruby/reline] Remove unnecessary clearing signal handler
7a758e73dc
2021-12-21 00:13:18 +09:00
aycabta
6ccc15c2ab [ruby/reline] Rename an unused variable name for CI
ba97f3bd87
2021-12-20 15:52:51 +09:00
aycabta
145c1e0691 [ruby/reline] Add support for overwriting dialog proc with the same name
16aa20c380
2021-12-20 14:54:42 +09:00
aycabta
cf508d4db9 [ruby/reline] Add space
4b7fa6b213
2021-12-20 14:53:45 +09:00
YO4
2a8ff602e0 [ruby/reline] windows jruby issue
jruby needs terminal control with Windows API  on classic console

b61bc43374
2021-12-20 14:51:52 +09:00
YO4
65cb250cb1 [ruby/reline] windows clear screen with \e 2 J
Windows Terminal does smart screen clearing when \e 2 J (not clear entire screen but scrolls down just needed)

On consoles not support sequences, ruby still converts it to API call.

c00930dab9
2021-12-20 14:51:52 +09:00
YO4
2c415cda85 [ruby/reline] windows improve scrolling
ScrollConsoleScreenBuffer can't scroll window of Windows Terminal.
Use LF to sctoll.

Microsoft says
```In the virtual terminal sequences world, the size of the window and the size of the screen buffer are fixed to the same value.
```
https://docs.microsoft.com/en-us/windows/console/window-and-screen-buffer-size

9ff3c70732
2021-12-20 14:51:51 +09:00
aycabta
a856489be6 [ruby/reline] Revert "Add a space after a comma"
This reverts commit 6009b3ef7a.

To merge a Pull Request...

83021f4267
2021-12-20 14:50:41 +09:00
aycabta
7dd0e91cac [ruby/reline] Revert "Add space"
This reverts commit 1bb071bcf5.

To merge a Pull Request...

e9fe1b1305
2021-12-20 14:46:35 +09:00
Nobuyoshi Nakada
a81e0600a7 [ruby/reline] Load correct version.rb from gemspec
When merged to ruby/ruby, reline.gemspec file is located under
lib/reline, as the same as reline/version.rb.  That is the latter
path relative from the former differs from the ruby/reline case,
and the reline/version.rb in the default load path will be loaded.
Try `require_relative` not to load unexpected files.

54905d0e1b
2021-12-19 12:14:10 +09:00
aycabta
7159af3491 [ruby/reline] Clear dialog in pasting
dabf5313e0
2021-12-19 11:19:50 +09:00
aycabta
1c49d809f4 [ruby/reline] Remove unnecessary "*"
7b50638e24
2021-12-18 10:18:33 +09:00
aycabta
7f2123bc08 [ruby/reline] Add a space after a comma
6009b3ef7a
2021-12-18 10:18:32 +09:00
aycabta
8cc01b668a [ruby/reline] Add space
1bb071bcf5
2021-12-18 10:15:23 +09:00
aycabta
8411e8449b [ruby/reline] Remove unnecessary variables, lower_space
The number of lines below the cursor position was known by
"@rest_height" alone, but the problem was caused by adding
"lower_space". Remove "lower_space" as it is unnecessary.

a575cef6a3
2021-12-13 20:44:21 +09:00
Samuel Williams
b5c4570af4 [ruby/reline] Prefer wait_readable for fiber scheduler.
06b4aa31fd
2021-12-11 14:29:20 +09:00
ima1zumi
5f1975a454 [ruby/reline] @convert_meta is true unless 8-bit characters
If Reline::IOGate.encoding contains 7-bit characters, convert-meta will set it On.

Because in readline(3):

>  The default is On, but readline will set it to Off if the locale contains eight-bit characters.

As far as I know, 7-bit encoding used in terminals is only US-ASCII.

b71d1fa496
2021-12-10 22:19:14 +09:00
ima1zumi
519a945efc [ruby/reline] Execute compress_meta_key if convert_meta is on
fix `#357`

When using 8-bit characters, it is better not to use `compress_meta_key`.
I believe not to use `compress_meta_key` unless `set convert-meta on` is written in the `.inputrc`.

The following is a quote from tmtm's comments.

> The behavior of this compress_meta_key method is similar to the behavior of convert-meta=on in readline, but readline turns off convert-meta if the locale contains 8bit characters.

> In readline(3):

> convert-meta (On)
> If set to On, readline will convert characters with the eighth
> bit set to an ASCII key sequence by stripping the eighth bit and
> prefixing it with an escape character (in effect, using escape
> as the meta prefix). The default is On, but readline will set
> it to Off if the locale contains eight-bit characters.

9491cc8542

Co-authored-by: TOMITA Masahiro <tommy@tmtm.org>
2021-12-10 22:19:14 +09:00
YO4
3a2ae5bb19 [ruby/reline] unleash real pasting speed
2700msec -> 410msec

read 80 console inputs at once

eb3ef7af98
2021-12-10 22:18:26 +09:00
YO4
74765a5a36 [ruby/reline] unleash pasting speed
074e407c62
2021-12-10 22:18:25 +09:00
YO4
aed21d6574 [ruby/reline] support input surrogate paird codepoint
support surrogate pair input

0b4acedc6a
2021-12-10 22:16:46 +09:00
YO4
66e14e2076 [ruby/reline] follow consolemode change
fix 'https://github.com/ruby/reline/issues/300'

b2cc6805a8
2021-12-10 22:15:56 +09:00
ima1zumi
4d4716d939 [ruby/reline] No need to check x > 0
Checked in the previous line.

bf774c0f2c
2021-12-03 00:39:30 +09:00
ima1zumi
ca33b59099 [ruby/reline] fix TerminfoError -> Reline::Terminfo::TerminfoError
c07b0ace6a
2021-12-02 23:41:44 +09:00
ima1zumi
697d7b8d62 [ruby/reline] Rescue if tigetstr(capname) cannot be obtained
fix https://github.com/ruby/reline/issues/384

If `$TERM` is `vt102`, there are no `kend`, `khome`, `civis`, or `cnorm` in capabilities.
`TerminfoError` is raised in `Reline::Terminfo.tigetstr(capname)`, so it is rescued if it does not exist.

c9f5112702
2021-12-02 23:41:43 +09:00
ima1zumi
f5829e2935 [ruby/reline] Correct padding space calculation
fix https://github.com/ruby/irb/issues/308

This bug occurred when `dialog.width - calculate_width(s, true)` was negative.

When `dialog.width` is shorter than `old_dialog.width`, it calculates how much padding it has to do. However, there are cases where `s` is longer than `dialog.width`, as in the issue. In that case, `padding_space_with_escape_sequences` will crash.

Here, `old_dialog.width` is longer than `dialog.width`, so I changed the padding width to `old_dialog.width - dialog.width`.

c581c31e0f
2021-11-21 13:56:26 +09:00
Nobuyoshi Nakada
a48dc89547 [ruby/reline] Check the result of GetConsoleScreenBufferInfo
42edf7b3aa
2021-10-12 13:19:25 +09:00
Nobuyoshi Nakada
1009fd7ee3 [ruby/reline] Revert "Fix zero division when the screen width is not available"
This reverts commit 0dce9da083541f42c31822a91c72f339934c3986.

f71471cdde
2021-10-12 13:19:24 +09:00
Nobuyoshi Nakada
60689f0f20 [ruby/reline] Fix zero division when the screen width is not available
0dce9da083
2021-10-12 00:40:22 +09:00
aycabta
e212d051d0 [ruby/reline] Rescue LoadError to require 'fiddle'
fe504bb6b9
2021-10-11 21:34:31 +09:00
aycabta
89556a6555 [ruby/reline] Remove a comment for debug
5f3ccda3d5
2021-10-11 21:17:02 +09:00
aycabta
56140bc7af [ruby/reline] Version 0.2.8.pre.11
de858ee1ac
2021-10-09 23:27:40 +09:00