summaryrefslogtreecommitdiff
path: root/lib/reline/line_editor.rb
AgeCommit message (Collapse)Author
2025-01-24Migrate irb and reline to the bundled gemsHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12624
2025-01-06[ruby/reline] Enter newline if cursor position is middle of inputMari Imaizumi
(https://github.com/ruby/reline/pull/802) * Enter newline if cursor position is middle of input * Add ed_force_submit to allow input confirmation on non-final lines https://github.com/ruby/reline/commit/8ef534e904
2025-01-05[ruby/reline] Fix bracketed paste and scrolling bugtomoya ishida
(https://github.com/ruby/reline/pull/801) * Fix set_pasting_state bug with bracketed paste * Fix rendered cursor_y caching in case of rendering the screen without scroll_into_view https://github.com/ruby/reline/commit/c5d5c444df
2025-01-03[ruby/reline] Refactor handling key in LineEditortomoya ishida
(https://github.com/ruby/reline/pull/799) Simplify the complicated flow of waiting_proc, wrap_method_call and run_for_operation https://github.com/ruby/reline/commit/72c0ec0425
2024-12-26[ruby/reline] Fix typos in commentYudai Takada
(https://github.com/ruby/reline/pull/796) * s/Calcualte/Calculate/ * s/unneccesary/unnecessary/ https://github.com/ruby/reline/commit/db86bcd2bf Notes: Merged: https://github.com/ruby/ruby/pull/12469
2024-12-16[ruby/reline] Change quoted_insert and bracketed_paste to a singletomoya ishida
key input (https://github.com/ruby/reline/pull/792) https://github.com/ruby/reline/commit/8f331edb07
2024-12-12[ruby/reline] Undo and redo should restore indentationtomoya ishida
(https://github.com/ruby/reline/pull/793) * Undo and redo should restore indentation Undo and redo should not perform auto indentation. It should not change the indentation. Instead, it should restore previous indentation. * Rename ivar undoing(undoing or redoing) to restoring https://github.com/ruby/reline/commit/6355a6e0b2
2024-12-10[ruby/reline] Fix line wrapped cursor positiontomoya ishida
(https://github.com/ruby/reline/pull/791) Cursor position calculation was wrong when the input line contains "\1" or CSI escape sequence. https://github.com/ruby/reline/commit/a1943daaf4
2024-12-06[ruby/reline] Combine MAPPINGS(single byte input to symbol) withtomoya ishida
key_bindings(escape sequence to symbol) (https://github.com/ruby/reline/pull/715) https://github.com/ruby/reline/commit/6a7e249374
2024-12-02[ruby/reline] Implement buffered output to Reline::ANSItomoya ishida
(https://github.com/ruby/reline/pull/790) Minimize the call of STDOUT.write This will improve rendering performance especially when there is a busy thread `Thread.new{loop{}}` https://github.com/ruby/reline/commit/a6fe45f5ba
2024-11-29[ruby/reline] Don't skip start_with check on encoding-incompatibletomoya ishida
candidates (https://github.com/ruby/reline/pull/787) https://github.com/ruby/reline/commit/8588be652f
2024-11-29[ruby/reline] Fix RELINE_TEST_ENCODINGMari Imaizumi
(https://github.com/ruby/reline/pull/743) * Fix RELINE_TEST_ENCODING It was not working because it was not environment variable. * Fix Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 Error: test_completion_append_character(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:948:in 'Reline::KeyActor::EmacsTest#test_completion_append_character' =============================================================================== =============================================================================== Error: test_continuous_completion_disabled_with_perfect_match(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:936:in 'Reline::KeyActor::EmacsTest#test_continuous_completion_disabled_with_perfect_match' =============================================================================== =============================================================================== Error: test_continuous_completion_with_perfect_match(Reline::KeyActor::EmacsTest): Encoding::CompatibilityError: Shift_JIS is not compatible with UTF-8 /home/runner/work/reline/reline/lib/reline/line_editor.rb:814:in 'block in Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Array#select' /home/runner/work/reline/reline/lib/reline/line_editor.rb:808:in 'Reline::LineEditor#filter_normalize_candidates' /home/runner/work/reline/reline/lib/reline/line_editor.rb:831:in 'Reline::LineEditor#perform_completion' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1434:in 'Reline::LineEditor#complete' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Method#call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:961:in 'Reline::LineEditor#wrap_method_call' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1029:in 'block in Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:932:in 'Reline::LineEditor#run_for_operators' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1028:in 'Reline::LineEditor#process_key' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1051:in 'Reline::LineEditor#normal_char' /home/runner/work/reline/reline/lib/reline/line_editor.rb:1089:in 'Reline::LineEditor#input_key' /home/runner/work/reline/reline/test/reline/helper.rb:124:in 'block in Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Array#each' /home/runner/work/reline/reline/test/reline/helper.rb:117:in 'Reline::TestCase#input_keys' /home/runner/work/reline/reline/test/reline/test_key_actor_emacs.rb:924:in 'Reline::KeyActor::EmacsTest#test_continuous_completion_with_perfect_match' =============================================================================== Finished in 2.118582151 seconds. 385 tests, 1762 assertions, 0 failures, 3 errors, 0 pendings, 3 omissions, 0 notifications https://github.com/ruby/reline/commit/4df825c48f
2024-11-26[ruby/reline] KeyStroke handles multibyte charactertomoya ishida
(https://github.com/ruby/reline/pull/713) https://github.com/ruby/reline/commit/5a8da85f2b
2024-11-25[ruby/reline] Fix tab completion appending quotetomoya ishida
(https://github.com/ruby/reline/pull/782) https://github.com/ruby/reline/commit/cbf213291c
2024-11-24[ruby/reline] Fix completion quote, preposing and target calculationtomoya ishida
bug (https://github.com/ruby/reline/pull/763) https://github.com/ruby/reline/commit/d3ba7216eb
2024-11-11[ruby/reline] Refactor perform_completontomoya ishida
(https://github.com/ruby/reline/pull/778) Flatten recursive method Remove CompletionState::COMPLETE https://github.com/ruby/reline/commit/aa5b278f3d
2024-11-10[ruby/reline] Remove unused things from reline/unicode.rbtomoya ishida
(https://github.com/ruby/reline/pull/759) * Remove garbage(nil) from Reline::Unicode.split_by_width result * Remove unused width from Reline::Unicode vi_ ed_ em_ method return value * Remove unused height from Unicode.split_by_width return value * Rename split_by_width to split_line_by_width and add legacy split_by_width for IRB https://github.com/ruby/reline/commit/f32446ebc4
2024-11-08[ruby/reline] Windows fix (https://github.com/ruby/reline/pull/775)YO4
* test_yamatanooroti: close tempfile before unlink * test_yamatanooroti: omit because of windows does not support job control * test_yamatanooroti: change startup message detection for windows * windows.rb: can call win32api using nil as NULL for pointer argument Exception occurred when interrupted with Ctrl+C on legacy conhost * windows.rb: fix get_screen_size return [window height, buffer width] insted of [buffer height, buffer width] * windows.rb: import scroll_down() from ansi.rb * windows.rb: add auto linewrap control if VT output not supported (legacy console) * unfreeze WIN32API pointer arguments They internally duplicate arguments so api functions write to another place. This breaks the console mode detection with ruby-head. * remove useless code from Win32API#call argument repacking and return value tweaking is not needed for Reline::Windows requirements. * Correctly handle top of console viewport * Revert "remove useless code from Win32API#call" This reverts commit https://github.com/ruby/reline/commit/060ba140ed43. * Revert "windows.rb: can call win32api using nil as NULL for pointer argument" This reverts commit https://github.com/ruby/reline/commit/93a23bc5d0c9. https://github.com/ruby/reline/commit/47c1ffbabe
2024-10-24[ruby/reline] nonprinting_start and nonprinting_end should betomoya ishida
removed (https://github.com/ruby/reline/pull/771) https://github.com/ruby/reline/commit/e36441652a
2024-10-24append completion_append_character only when continous completion is … (#764)Wu
* append completion_append_character only when continous completion is not possible * refactoring * remove debug puts
2024-10-22[ruby/reline] Use IO's encoding instead of Encoding.default_externalWu
(https://github.com/ruby/reline/pull/765) * use IO's encoding * refactoring * remove unused encoding params * (for retriggering CI) remove unused encoding params https://github.com/ruby/reline/commit/f09772adab
2024-10-13[ruby/reline] Support continuous tab completiontomoya ishida
(https://github.com/ruby/reline/pull/761) Continuous tab completion is possible in GNU Readline. If dig_perfect_match_proc is set, continuous tab completion will be disabled. https://github.com/ruby/reline/commit/469a52846b
2024-10-12[DOC] Fix spellingJohn Bampton
Notes: Merged: https://github.com/ruby/ruby/pull/11884 Merged-By: nobu <nobu@ruby-lang.org>
2024-10-02[ruby/reline] Fix incremental search cancel bugtomoya ishida
(https://github.com/ruby/reline/pull/748) https://github.com/ruby/reline/commit/bf0f8fa333
2024-10-01[ruby/reline] Fix Reline crash with invalid encoding historytomoya ishida
(https://github.com/ruby/reline/pull/751) https://github.com/ruby/reline/commit/e9d4b37e34
2024-09-04[ruby/reline] Split render_differential to LineEditor's renderingtomoya ishida
logic and actual differential rendering part (https://github.com/ruby/reline/pull/731) https://github.com/ruby/reline/commit/c90f08f7e3
2024-09-03[ruby/reline] Fix redisplay/insert_text called from pre_input_hooktomoya ishida
(https://github.com/ruby/reline/pull/742) * Fix redisplay/insert_text called from pre_input_hook * Rename insert_pasted_text to insert_multiline_text It is now used from Reline.insert_text which is not inserting pasted text https://github.com/ruby/reline/commit/694a540939
2024-08-31[ruby/reline] Implement re-read-init-fileMari Imaizumi
(https://github.com/ruby/reline/pull/740) https://github.com/ruby/reline/commit/59e4ade807
2024-07-12[ruby/reline] Fix rendering bug of nomultiline prompttomoya ishida
(https://github.com/ruby/reline/pull/730) Fix bug of `print('a'*10); Reline.readline('>')` wrong rendering https://github.com/ruby/reline/commit/c0469a12b9
2024-06-18[ruby/reline] Fix vi_yank or vi_delete_meta copies nil bugtomoya ishida
(https://github.com/ruby/reline/pull/726) https://github.com/ruby/reline/commit/46b30b07c9
2024-06-06[ruby/reline] Remove instance variable @first_chartomoya ishida
(https://github.com/ruby/reline/pull/717) When Reline reads EOF, Reline.readline should return nil if and only if input is empty https://github.com/ruby/reline/commit/cc74b3686a
2024-06-05[ruby/reline] Refactor input key readingtomoya ishida
(https://github.com/ruby/reline/pull/712) * Add key binding matching status :matching_matched * Simplify read_2nd_character * Add a comment of matching status and EOF * Matching status to a constant * Expand complicated ternary operators to case-when https://github.com/ruby/reline/commit/64deec100b
2024-06-03[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
2024-06-03[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-06-01[ruby/reline] Overhaul io gate structureStan Lo
(https://github.com/ruby/reline/pull/666) * Overhaul IO gate structure 1. Move IO related classes to `lib/reline/io/` directory. 2. Rename `GeneralIO` to `Dumb`. 3. Use IO classes as instances instead of classes. * Update lib/reline/io/ansi.rb Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com> --------- https://github.com/ruby/reline/commit/dc1518e1ac Co-authored-by: tomoya ishida <tomoyapenguin@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-10[ruby/reline] Avoid STDIN.winsize called in `require "reline"`tomoya ishida
(https://github.com/ruby/reline/pull/703) https://github.com/ruby/reline/commit/21891c47c4
2024-05-08[ruby/reline] Implement bracketed paste inserttomoya ishida
(https://github.com/ruby/reline/pull/655) https://github.com/ruby/reline/commit/e92dcbf514
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-05-02[ruby/reline] Fix prompt width calculation bug. Test with coloredtomoya ishida
prompt (https://github.com/ruby/reline/pull/695) https://github.com/ruby/reline/commit/24aab01cbc
2024-04-29[ruby/reline] Input with eof and no newline bugfixtomoya ishida
(https://github.com/ruby/reline/pull/671) https://github.com/ruby/reline/commit/0d66c335a1
2024-04-29[ruby/reline] Completely support full-width characters intomoya ishida
differential rendering (https://github.com/ruby/reline/pull/654) * Add a cut variation of Reline::Unicode.take_range method take_mbchar_range * Consider fullwidth take_range in differential rendering https://github.com/ruby/reline/commit/29714df09f
2024-04-24[ruby/reline] Long line performancetomoya ishida
(https://github.com/ruby/reline/pull/688) * Improve C-e (ed_move_to_end) performance for long line * Reline::Unicode.split_by_width optimization for RESET_SGR https://github.com/ruby/reline/commit/0c8d3c827a
2024-04-23[ruby/reline] Separate prompt and input line in renderingtomoya ishida
(https://github.com/ruby/reline/pull/652) * Separate prompt and input line in rendering Often, only one of prompt and input changes. Split prompt+input_line to a separate rendering item will improve differential rendering performance. * Rename method wrapped_prompt_lines to more descriptive name https://github.com/ruby/reline/commit/16d82f1f23
2024-04-19[ruby/reline] Implement `show-all-if-ambiguous` featureMari Imaizumi
(https://github.com/ruby/reline/pull/683) https://github.com/ruby/reline/commit/0fe4fdc794
2024-04-18[ruby/reline] Remove unused variableKenichi Kamiya
(https://github.com/ruby/reline/pull/684) https://github.com/ruby/reline/commit/ce30c23730
2024-04-17[ruby/reline] Refactor nomultiline and multiline mode differencetomoya ishida
(https://github.com/ruby/reline/pull/653) * Support multiline input in Reline.readline internally, reduce multiline-singleline branch * Add readline(singleline) prompt test with force inserting multiline text https://github.com/ruby/reline/commit/97846095d7
2024-04-16[ruby/reline] Refactor history move and history searchtomoya ishida
(https://github.com/ruby/reline/pull/651) https://github.com/ruby/reline/commit/90e43e01d4
2024-04-16[ruby/reline] Implement changing editing modeMari Imaizumi
(https://github.com/ruby/reline/pull/681) https://github.com/ruby/reline/commit/501b9a6c5f