summaryrefslogtreecommitdiff
path: root/test/reline/test_key_actor_emacs.rb
AgeCommit message (Collapse)Author
12 days[ruby/reline] In ed_search_[prev|next]_history, make the cursor comeHiroaki Osawa
to the end of the line when there is no search substr (https://github.com/ruby/reline/pull/714) * In ed_search_prev_history, make the cursor come to the end of the line when there is no search substr * In ed_search_next_history, make the cursor come to the end of the line when there is no search substr * Implemented ActionState to search with empty substr if the previous operation was search with empty string. * Use a simple 2-element array to represent action_state https://github.com/ruby/reline/commit/95ee80bd70
12 days[ruby/reline] Improve key binding match/matching checktomoya ishida
(https://github.com/ruby/reline/pull/709) * Improve key binding match/matching check * Rename key_actors to default_key_bindings * Make key_stroke.expand always return a value * Update add_default_key_binding to use a add_default_key_binding_by_keymap internally Co-authored-by: Stan Lo <stan001212@gmail.com> --------- https://github.com/ruby/reline/commit/353ec236e2 Co-authored-by: Stan Lo <stan001212@gmail.com>
2024-05-27[ruby/reline] Implement the redo commandverdy89
(https://github.com/ruby/reline/pull/707) * Implement the redo command * Commented out a test that does not pass * Changed key assignment for redo from "\C-[" to "\C-g" * Changed redo key assignment from `\C-g` to `\M-\C-_` * Revert the first implemantation * Implemented redo by sharing `@past_lines` between undo and redo * Fixed the index of past_lines that is updated when the cursor is moved * Fixed deletion of the redo history in regular input * Renamed variables: past_lines -> input_lines * Rename @position to @input_lines_position * Deleted unused variables: `@old_byte_pointer` and `@old_line_index` https://github.com/ruby/reline/commit/0b2d9fab5f
2024-05-14[ruby/reline] Implement the undo commandMari Imaizumi
(https://github.com/ruby/reline/pull/701) * Refactor send * Implement the undo command * Fix @past_lines initialization * Improve assertion * Hide to save buffer in insert_pasted_text * Replace @using_delete_command with @undoing * Refactor `@past_lines` https://github.com/ruby/reline/commit/4ab72f9cbd
2024-05-05[ruby/reline] Add name defined in readline to completion keytomoya ishida
bindings C-i C-p C-n (https://github.com/ruby/reline/pull/698) https://github.com/ruby/reline/commit/1314787bbb
2024-04-16[ruby/reline] Implement changing editing modeMari Imaizumi
(https://github.com/ruby/reline/pull/681) https://github.com/ruby/reline/commit/501b9a6c5f
2024-04-14[ruby/reline] Refactor waiting_proc and waiting_operator_proctomoya ishida
(https://github.com/ruby/reline/pull/649) * Fix waiting_proc precedence * Fix waiting_operator bugs * Add waiting_proc and vi_waiting_operator test * Fix vi waiting operator arg number vi_arg and vi_waiting_operator_arg should be multiplied * Implement `yy` copies whole line in vi_command mode * Simplify incremental search cancel test * Add complex vi test with waiting_proc and vi_waiting_operator, split test input https://github.com/ruby/reline/commit/777dffae1c
2024-04-14[ruby/reline] Support `menu-complete-backward` command for upwardMichael J. Giarlo
navigation (https://github.com/ruby/reline/pull/677) Fixes https://github.com/ruby/reline/pull/675 This commit extracts the upward navigation condition in `LineEditor#input_key` to a new private method, and adds a new alias. This change allows Reline to support upward navigation in when a user has configured `inputrc` to map Shift-Tab to `menu-complete-backward`, a common setting in Bash (>= 4.x). Instead of special-casing upward navigation in `LineEditor#input_key`, we now allow it to be processed by the branch that calls `process_key`. The extracted method no longer includes the editing mode check since this check is already made by `#wrap_method_call` by the time `#completion_journey_up` (or `#menu_complete_backward`) is called. Since upward navigation is happening in a method other than `#input_key` now, the `completion_occurs` variable that used to be local to `#input_key` is changed to an instance variable so that the new method can change its value. (I see many examples of mutating such instance variables in `LineEditor`, so I assumed this would be an uncontroversial change consistent with the coding practices already in place.) Test coverage of this change has been added to the emacs and vi `KeyActor` tests. Many thanks to @ima1zumi for their very helpful comments on #675 which encouraged me to contribute this work! https://github.com/ruby/reline/commit/2ccdb374a4
2024-04-04[ruby/reline] Handle INT signal correctly, remove handle_clearedtomoya ishida
because clear(C-l) is not a signal (https://github.com/ruby/reline/pull/646) https://github.com/ruby/reline/commit/3debb0ae2f
2024-03-24[ruby/reline] Refactor key actor testtomoya ishida
(https://github.com/ruby/reline/pull/645) * Add assertion assert_cursor_line to test helper * Autofix key_actor test to use assert_cursor_line * Rename the assertion to assert_line_around_cursor and remove other assertions for line and cursor https://github.com/ruby/reline/commit/e4773800c6
2024-03-19[ruby/reline] Reline 0.5.0.pretomoya ishida
(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 --------- https://github.com/ruby/reline/commit/3fa376217d Co-authored-by: Stan Lo <stan001212@gmail.com>
2023-07-07[ruby/reline] Reduce direct references to `Reline::IOGate`Stan Lo
(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-04-05Use `em_delete` in `key_delete` (#504)Étienne Barrié
* 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.
2021-12-30[ruby/reline] Use unix_line_discard when Ctrl-u is enteredima1zumi
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. https://github.com/ruby/reline/commit/27570d195e
2021-12-24[ruby/reline] Implement em_kill_lineaycabta
https://github.com/ruby/reline/commit/9fca6ceb45
2021-12-24[ruby/reline] Bind ed-kill-line to C-u on emacs modeaycabta
https://github.com/ruby/reline/commit/9ab99574f5
2021-12-24[ruby/reline] Fix test input_keys to handle "hankaku" characters correctly ↵Yusuke Endoh
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. https://ci.appveyor.com/project/ruby/ruby/builds/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. https://github.com/ruby/reline/commit/f6ae0e5d19
2021-12-24[ruby/reline] Add a test for halfwidth kana width dakutenaycabta
https://github.com/ruby/reline/commit/0895a0d4a1
2021-09-29[ruby/reline] Support ed_argument_digit by M+numaycabta
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"). https://github.com/ruby/reline/commit/9183cc2e8b
2021-09-28[ruby/reline] Ignore NUL by ed_quoted_insertaycabta
https://github.com/ruby/reline/commit/43b7c01a98
2021-08-30[ruby/reline] Disable autocompletion in testsaycabta
https://github.com/ruby/reline/commit/9b1913567a
2021-07-30[ruby/reline] Use "omit" instead of "return"aycabta
https://github.com/ruby/reline/commit/940cdaa301
2021-06-25Revert "Revert "[ruby/reline] Fix failed test""aycabta
I'm so sorry, the previous revert was just a mistake. This reverts commit 9103c3ba8bc09f287f69ca322f58faa34e003f2e.
2021-06-25Revert "[ruby/reline] Fix failed test"aycabta
This reverts commit 491591c7cee842601118efc2698e0e41283827b3.
2021-06-25[ruby/reline] Fix failed testima1zumi
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. https://github.com/ruby/reline/commit/10e1ce3320
2021-06-21Stop using global constant, RELINE_TEST_ENCODINGaycabta
2021-06-21Call Reline.test_reset in teardown definitelyaycabta
2021-06-21[ruby/reline] Remove an obsolete commented-out testaycabta
https://github.com/ruby/reline/commit/5354d02e03
2021-02-21[ruby/reline] Return 1 when char width not foundaycabta
This fixes ruby/reline#261. https://github.com/ruby/reline/commit/3cf1213014
2021-01-13[ruby/reline] Handle ed_search_{prev,next}_history in multiline correctlyaycabta
The current line was being handled incorrectly when displaying the hit history, so it has been fixed to be correct. https://github.com/ruby/reline/commit/a3df4343b3
2020-12-22[ruby/reline] Support isearch-terminatorsaycabta
https://github.com/ruby/reline/commit/a7922da16b
2020-12-19[ruby/reline] Yank by em-kill-region correctlyaycabta
This closes ruby/reline#106. https://github.com/ruby/reline/commit/2549a52e15
2020-12-19[ruby/reline] Bind yank-pop correctlyaycabta
https://github.com/ruby/reline/commit/3c74beac65
2020-12-11Strip trailing spaces [ci skip]Nobuyoshi Nakada
2020-12-11[ruby/reline] Fix breaking to input Emoji with ZWJ.ima1zumi
https://github.com/ruby/reline/commit/f21dfdbb11
2020-12-05[ruby/reline] Skip em_exchange_mark without markaycabta
https://github.com/ruby/reline/commit/abb56e5ec3
2020-12-05[ruby/reline] Deduplicate completed itemsaycabta
https://github.com/ruby/reline/commit/2dabf0c786
2020-04-18[ruby/reline] Add ed_search_next_historyaycabta
https://github.com/ruby/reline/commit/ca750b676b
2020-04-18[ruby/reline] Add ed_search_prev_historyaycabta
https://github.com/ruby/reline/commit/e9ae288825
2020-04-18[ruby/reline] Rename wrong test nameaycabta
https://github.com/ruby/reline/commit/8480db575b
2020-03-27[ruby/reline] Suppress $/ warningsNobuyoshi Nakada
https://github.com/ruby/reline/commit/f4eac8c76f
2020-03-26[ruby/reline] Work with wrong $/ value correctlyaycabta
https://github.com/ruby/reline/commit/962ebf5a1b
2020-01-14Introduce an abstracted structure about the encoding of Relineaycabta
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-06Complete indented and quoted string correctlyaycabta
def foo ''.upca[TAB] This will be completed to be: def foo ''.upcase The indent was gone. This commit fixes the bug.
2019-12-27Add test_completion_with_indent_and_completer_quote_charactersaycabta
This is for 8a705245e55575d4d310a2e956b89a36a5931971.
2019-12-24The delete-char-or-list shows completed list when called at end of lineaycabta
It doesn't behave the same as the delete-char.
2019-12-17Support change search directionaycabta
2019-12-17Support forward-search-history by C-saycabta
2019-12-13Show a menu before a documentaycabta
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-12Suppress to crash IRB if completed list has nilaycabta