Commit graph

624 commits

Author SHA1 Message Date
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
aycabta
9cb7ba2f21 [ruby/reline] Add RELINE_ALT_SCROLLBAR env to use alternative text for scrollbar
The setting to use '::' instead of block elements.

4afbc98e2c
2021-10-09 23:23:02 +09:00
aycabta
e6ba2953e9 [ruby/reline] Fix calculating dialog width with full-width scrollbar
93bc9b5277
2021-10-09 23:22:57 +09:00
aycabta
ded5a66cb9 [ruby/reline] Use alternate text for scrollbar in non-UTF-8 env
69e365edcc
2021-10-08 18:48:44 +09:00
Jeremy Evans
55d7f63bde [ruby/reline] Better fix for non-UTF-8 default external encoding
Previous fix didn't show the cursor or dialogs.  This allows the
dialogs to continue to work.

651c5f63cc
2021-10-08 10:38:47 +09:00
Jeremy Evans
eb4682b3c6 [ruby/reline] Only show dialogs if default external encoding is UTF-8
Fixes a crash in IRB if a dialog is displayed and the default
external encoding is not UTF-8:

/home/jeremy/tmp/reline/lib/reline/line_editor.rb:731:in `write': U+2588 from UTF-8 to US-ASCII (Encoding::UndefinedConversionError)

f570525ecd
2021-10-08 10:38:43 +09:00
aycabta
374b15a84a [ruby/reline] Cut off the excess on narrow screen
972cc993ca
2021-10-08 10:33:22 +09:00
aycabta
a2f55679f0 [ruby/reline] Rename DIALOG_HEIGHT with DIALOG_DEFAULT_HEIGHT
996bfec64b
2021-10-08 10:33:17 +09:00
aycabta
f625645a37 [ruby/reline] The width of block elements is 1 on Windows
5f4a75c7a0
2021-10-05 22:33:07 +09:00
aycabta
6966c3ff44 [ruby/reline] Change struct size correctly
df2a1b4e08
2021-10-05 22:32:56 +09:00
aycabta
1e9714cf34 [ruby/reline] Use default background color to erase on Windows
852e855d82
2021-10-04 00:14:10 +09:00
aycabta
64e96d6b41 [ruby/reline] Re-calc the scroll pos when the content in dialog is shortened
12ea63e6e0
2021-10-03 21:51:02 +09:00
aycabta
7f02cc50dd [ruby/reline] Version 0.2.8.pre.10
1c6c0c82f0
2021-10-03 21:48:12 +09:00
aycabta
6cb37d4136 [ruby/reline] Initialize @trap_key to suppress warning
b42c0980d9
2021-10-03 21:38:05 +09:00
aycabta
bf4f3ef5ad [ruby/reline] Add a comment to use "private alias_method" idiom after drop Ruby 2.5
1b00cae0fd
2021-10-03 18:41:29 +09:00
aycabta
b91b3000bd [ruby/reline] Add code block notation in doc
b283791dc5
2021-10-03 15:31:47 +09:00
aycabta
bc5407f00c [ruby/reline] Add doc for ed-unassigned and ed-insert macro
7fe9ecf945
2021-10-03 15:25:50 +09:00
aycabta
95522ef8b9 [ruby/reline] Rerender whole buffer when argument editing finished
If the argument prompt disappears when pasting is finished, rerender the
whole buffer.

996bbf8797
2021-10-03 14:53:13 +09:00
aycabta
bf0a8a7462 [ruby/reline] Call LineEditor#resize on Windows
65b27dd2ff
2021-10-03 14:27:33 +09:00
TOMITA Masahiro
ef350b3a56 [ruby/reline] Simplify SIGWINCH handler to avoid aborting when resizing.
481add0537
2021-10-03 14:26:53 +09:00
aycabta
4401bbe8a7 [ruby/reline] Use String#unpack1
179c52bca8
2021-10-03 14:08:55 +09:00
aycabta
a2d2f00e4a [ruby/reline] Adjust border of scrollbar rendering calculation
737b23beae
2021-10-03 14:08:49 +09:00
aycabta
1d2edda9f8 [ruby/reline] The @block_elem_width shouldn't be used for height calculation
da35902d78
2021-10-03 14:08:45 +09:00
aycabta
5eb8b6d1bd [ruby/reline] Support ed_argument_digit by M+num
The vi mode can handle "argument number" before an operator or a motion,
such as, "3x" (equals "xxx"), and "3l" (equals "lll"). In the emacs
mode, GNU Readline can handle argument number with meta key, like
"Meta+3 x" (equals "xxx").

9183cc2e8b
2021-09-29 22:07:49 +09:00
aycabta
c4acde8959 [ruby/reline] Ignore NUL by ed_quoted_insert
43b7c01a98
2021-09-28 14:15:49 +09:00
aycabta
a230ff0f83 [ruby/reline] ^K is kill-line and ^U is unix-line-discard for inputrc
5936071940
2021-09-27 01:16:15 +09:00
Jake Zimmerman
3f7b08d2cb [ruby/reline] Implement vi_kill_line_prev
This operation is mentioned and bound to `^U` in both `vi_command.rb`
and `vi_insert.rb`, but there is no definition of it.

Both Vi and Emacs use the same keystroke to do the same behavior, so
I've chosen to use `alias_method` to make the implementation small,
rather than duplicating the method and re-implementing it.

fdbfc8669f
2021-09-26 23:47:11 +09:00