Commit graph

64 commits

Author SHA1 Message Date
ima1zumi
f589242e75 [ruby/reline] Use unix_line_discard when Ctrl-u is entered
The kill-line was called when C-u was entered, so it is now called unix-line-discard.

In readline(3):

> unix-line-discard (C-u)
>               Kill backward from point to the beginning of the line.
>               The killed text is saved on the kill-ring.

27570d195e
2021-12-30 20:23:58 +09:00
aycabta
bad1e153d4 [ruby/reline] Implement em_kill_line
9fca6ceb45
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
Yusuke Endoh
424800f707 [ruby/reline] Fix test input_keys to handle "hankaku" characters correctly on Windows
The method "input_keys" in test/reline/helper.rb handles a single-byte
and 8-bit charater as an input with the meta key.
However, "test_halfwidth_kana_width_dakuten" in test/reline/test_key_actor_emacs.rb
uses a string that contains "hankaku" characters.
A "hankaku" character is not with the meta key, but it is a single-byte
and 8-bit character on Windows-31J encoding, which confused "input_keys"
method. This caused the following error.

41997092/job/ejm77qxgvnlpdwvg
```
  1) Failure:
Reline::KeyActor::Emacs::Test#test_halfwidth_kana_width_dakuten [C:/projects/ruby/test/reline/test_key_actor_emacs.rb:2311]:
<"\xB6\xDE\xB7\xDE\xB9\xDE\xBA\xDE" (#<Encoding:Windows-31J>)> expected but was
<"\e^\e^\e^\e:\e^" (#<Encoding:Windows-31J>)> in <Terminal #<Encoding:Windows-31J>>
.
<8> expected but was
<10>.
Finished tests in 1045.472722s, 19.3922 tests/s, 2609.4320 assertions/s.
```

This change introduces "input_raw_keys" that does not convert a
single-byte and 8-bit character to "with the meta key", and use it in
the test in question.

f6ae0e5d19
2021-12-24 15:01:17 +09:00
aycabta
547c27e9e7 [ruby/reline] Add a test for halfwidth kana width dakuten
0895a0d4a1
2021-12-24 00:51:48 +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
24a26db795 [ruby/reline] Disable autocompletion in tests
9b1913567a
2021-08-30 02:37:23 +09:00
aycabta
5313d234e0 [ruby/reline] Use "omit" instead of "return"
940cdaa301
2021-07-30 02:27:02 +09:00
aycabta
5ffb313ccc Revert "Revert "[ruby/reline] Fix failed test""
I'm so sorry, the previous revert was just a mistake.

This reverts commit 9103c3ba8b.
2021-06-25 18:56:46 +09:00
aycabta
9103c3ba8b Revert "[ruby/reline] Fix failed test"
This reverts commit 491591c7cee842601118efc2698e0e41283827b3.
2021-06-25 17:42:45 +09:00
ima1zumi
d340b091a8 [ruby/reline] Fix failed test
For ruby/ruby repository's AppVeyor CI (Windows environment), `Reline::IOGate.encoding` will be changed from `UTF-8` to `Windows-31J` after the test is run.
So, when `test/reline/test_key_actor_emacs.rb` is loaded, `Reline::IOGate.encoding == Encoding::UTF_8` will be `true`,
but at the time of test execution, `Reline::IOGate.encoding` is `Windows-31J`.
For this reason, I changed the test method to check `Reline::IOGate.encoding` in the test method.

10e1ce3320
2021-06-25 17:42:45 +09:00
aycabta
1192393b3e Stop using global constant, RELINE_TEST_ENCODING 2021-06-21 22:12:14 +09:00
aycabta
af19f9a6e9 Call Reline.test_reset in teardown definitely 2021-06-21 22:12:14 +09:00
aycabta
cf6f686d29 [ruby/reline] Remove an obsolete commented-out test
5354d02e03
2021-06-21 17:58:49 +09:00
aycabta
dc9e33016c [ruby/reline] Return 1 when char width not found
This fixes ruby/reline#261.

3cf1213014
2021-02-21 06:41:03 +09:00
aycabta
44817db28b [ruby/reline] Handle ed_search_{prev,next}_history in multiline correctly
The current line was being handled incorrectly when displaying the hit
history, so it has been fixed to be correct.

a3df4343b3
2021-01-13 01:12:54 +09:00
aycabta
b52bc4a9c2 [ruby/reline] Support isearch-terminators
a7922da16b
2020-12-22 23:45:43 +09:00
aycabta
d4257c6152 [ruby/reline] Yank by em-kill-region correctly
This closes ruby/reline#106.

2549a52e15
2020-12-19 02:12:11 +09:00
aycabta
af2c81e10c [ruby/reline] Bind yank-pop correctly
3c74beac65
2020-12-19 02:12:11 +09:00
Nobuyoshi Nakada
eea756ac86
Strip trailing spaces [ci skip] 2020-12-11 23:14:36 +09:00
ima1zumi
68d3952c52 [ruby/reline] Fix breaking to input Emoji with ZWJ.
f21dfdbb11
2020-12-11 23:08:06 +09:00
aycabta
564aadce62 [ruby/reline] Skip em_exchange_mark without mark
abb56e5ec3
2020-12-05 02:58:58 +09:00
aycabta
4af2e4111b [ruby/reline] Deduplicate completed items
2dabf0c786
2020-12-05 02:58:58 +09:00
aycabta
db0d850d4e [ruby/reline] Add ed_search_next_history
ca750b676b
2020-04-18 23:12:52 +09:00
aycabta
bea3e31e5f [ruby/reline] Add ed_search_prev_history
e9ae288825
2020-04-18 23:12:52 +09:00
aycabta
1e4efbb6d3 [ruby/reline] Rename wrong test name
8480db575b
2020-04-18 23:11:45 +09:00
Nobuyoshi Nakada
3486a460ea [ruby/reline] Suppress $/ warnings
f4eac8c76f
2020-03-27 19:04:03 +09:00
aycabta
f245fb1ab8 [ruby/reline] Work with wrong $/ value correctly
962ebf5a1b
2020-03-26 17:41:21 +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
439e1ccd08 Complete indented and quoted string correctly
def foo
    ''.upca[TAB]

This will be completed to be:

  def foo
  ''.upcase

The indent was gone. This commit fixes the bug.
2020-01-06 01:20:24 +09:00
aycabta
4db898284d Add test_completion_with_indent_and_completer_quote_characters
This is for 8a705245e5.
2019-12-27 16:07:52 +09:00
aycabta
42e2a322f1 The delete-char-or-list shows completed list when called at end of line
It doesn't behave the same as the delete-char.
2019-12-24 18:34:43 +09:00
aycabta
618d091151 Support change search direction 2019-12-17 13:10:39 +09:00
aycabta
a14a0244b4 Support forward-search-history by C-s 2019-12-17 13:07:19 +09:00
aycabta
c2dfc6d869 Show a menu before a document
IRB should show a menu first if a completed list has plural items. But just
shows document without menu if a completed list with plural items includes a
perfect matched item. The behavior is a bug. This commit fixes it.
2019-12-13 08:54:22 +09:00
aycabta
7d991a0571 Suppress to crash IRB if completed list has nil 2019-12-12 08:40:50 +09:00
aycabta
6a22b2a091 Support completion with case-insensitive fashion
Reline performs completion in a case-insensitive fashon if
Readline.completion_case_fold or completion-ignore-case of .inputrc are set
"on".
2019-12-10 07:07:43 +09:00
aycabta
a92560132b Support incremental search by last determined word
In the incremental search by C-r, search word is saved when it's determined. In
the next incremental search by C-r, if a user presses C-r again with the empty
search word, the determined previous search word is used to search.
2019-12-03 01:39:59 +09:00
aycabta
103b04128f Support incremental search again by C-r in incremental search 2019-12-02 04:18:22 +09:00
aycabta
e15b0313a7 Search history to back in the middle of histories 2019-12-02 03:09:41 +09:00
aycabta
7f0d51704a Remove obsolete code 2019-12-02 00:03:59 +09:00
aycabta
8cb3f29abf The ed_search_prev_history should always search to backward 2019-12-01 23:54:57 +09:00
aycabta
fa7618e4c1 Implement em_set_mark and em_exchange_mark 2019-11-15 16:50:40 +09:00
Alan Wu
e9f82585ee Don't crash when deleting at the end of the line
To reproduce this bug, type one character into irb, then press the
delete key on your keyboard.
2019-08-18 07:43:19 +09:00
manga_osyo
04e6b90d5b Remove unused method. 2019-07-15 00:33:16 +09:00
aycabta
02880d1f4a Skip transpose-words if less than 2 word 2019-06-06 04:57:52 +09:00
aycabta
eadc06ba16 Add test_ed_transpose_words_for_mbchar 2019-06-06 04:25:16 +09:00
aycabta
4b7213a85a Implement transpose-words 2019-06-04 07:23:36 +09:00
aycabta
182072b211 The C-q is also quoted insert in emacs mode 2019-06-03 04:17:52 +09:00