summaryrefslogtreecommitdiff
path: root/lib/reline.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-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
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-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-26[ruby/reline] KeyStroke handles multibyte charactertomoya ishida
(https://github.com/ruby/reline/pull/713) https://github.com/ruby/reline/commit/5a8da85f2b
2024-11-14[ruby/reline] Drop loading terminfo, remove fiddle dependency intomoya ishida
non-windows environment. (https://github.com/ruby/reline/pull/769) Reline works perfectly in most major terminal emulators without terminfo. In minor/old terminal emulator, we used to get key bindings from terminfo, but I think it is not used so much. https://github.com/ruby/reline/commit/3ceba3bff7
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-02[ruby/reline] Add a timeout to cursor_postomoya ishida
(https://github.com/ruby/reline/pull/750) https://github.com/ruby/reline/commit/dd4a654e5d
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-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-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-04Revert "Revert "[ruby/reline] Reline::ANSI is general io. Reline::GeneralIO ↵Takashi Kokubun
is not."" This reverts commit 6e84ac2359c8fc8cb686ef4644b9cae26cd5ab9e. Now that the rubygems spec change has been merged, let's try reverting this and fixing it with tompng's new patch.
2024-06-03Revert "[ruby/reline] Reline::ANSI is general io. Reline::GeneralIO is not."Takashi Kokubun
This reverts commit ba01d15cf5db96933905d669c68f5cc0cd6910b8. It seems to be failing test-bundler-parallel. Reverting it to normalize the CI. We should revert this revert once we figure it out.
2024-06-03[ruby/reline] Reline::ANSI is general io. Reline::GeneralIO is not.tomoya ishida
(https://github.com/ruby/reline/pull/659) Reline::ANSI has a partial non-tty supporting code. It should be a general io. Reline::Dumb should be only used in testing. https://github.com/ruby/reline/commit/2d6828473d
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-08[ruby/reline] Implement bracketed paste inserttomoya ishida
(https://github.com/ruby/reline/pull/655) https://github.com/ruby/reline/commit/e92dcbf514
2024-05-02[ruby/reline] Fix default and additional key bindings vanish bugtomoya ishida
(https://github.com/ruby/reline/pull/697) https://github.com/ruby/reline/commit/fc9b4d2274
2024-05-02[ruby/reline] Avoid reading .inputrc repeatedlyMari Imaizumi
(https://github.com/ruby/reline/pull/694) https://github.com/ruby/reline/commit/c8d4802a0f
2024-04-30[ruby/reline] Fix completion dialog position when completed part istomoya ishida
wordwrapped (https://github.com/ruby/reline/pull/692) https://github.com/ruby/reline/commit/2d9acd16fe
2024-04-05[ruby/reline] Thread safe readlinetomoya ishida
(https://github.com/ruby/reline/pull/669) Block until other Reline.readline or Reline.readmultiline finish https://github.com/ruby/reline/commit/ebab2875f1
2024-04-05[ruby/reline] Always call finalize and depreptomoya ishida
(https://github.com/ruby/reline/pull/668) https://github.com/ruby/reline/commit/91b030caa4
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-04-01[ruby/reline] Refactor completiontomoya ishida
(https://github.com/ruby/reline/pull/647) * Refactor completion: split autocompletion and tabcompletion logic and state * Move completion candidate listup logic from dialog proc to LineEditor https://github.com/ruby/reline/commit/c3c09ac9c2
2024-03-24[ruby/reline] Disable dialog proc if TERM=dumbtomoya ishida
(https://github.com/ruby/reline/pull/663) https://github.com/ruby/reline/commit/4928e06a24
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-11-06[ruby/reline] Introduce a new class Reline::Face to configureHASUMI Hitoshi
character attributes (https://github.com/ruby/reline/pull/552) * Reine::Face * fix test_yamatanooroti * Define singleton methods to make accessors to attributes of a face * s/display/foreground/ * s/default/default_style/ && s/normal_line/default/ && s/enhanced_line/enhanced/ * fix typo * FaceConfig.new now takes keyword arguments * Update lib/reline/face.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Update test/reline/test_face.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Fix to correspond to frozen_string_literal * Face::FaceConfig -> Face::Config * ref https://github.com/ruby/reline/pull/552#pullrequestreview-1677282576 * delete unused ivar * ref https://github.com/ruby/reline/pull/552#discussion_r1358783723 * insert "\e[0m" into all SGR * tiny fix * ESSENTIAL_DEFINE_NAMES ref https://github.com/ruby/reline/pull/552#discussion_r1367722247 * Change to Hash-accessor style - Reline::Face[:completion_dialog].enhanced -> Reline::Face[:completion_dialog][:enhanced] - Reline::Face.configs shows all defined values * Cache array method call in local variable * Tests for Face configuration variations * resolve https://github.com/ruby/reline/pull/552#pullrequestreview-1710938154 * amend to * check invalid SGR parameter in :style * The order of define values should be preserved * Update test/reline/test_face.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Update test/reline/test_face.rb Co-authored-by: Stan Lo <stan001212@gmail.com> * Add methods: load_initial_config and reset_to_initial_config. And teardown in tests * omission in amending "style: :default" to "style: :reset" * refs https://github.com/ruby/reline/issues/598 * Fix link * amend method name * Update lib/reline/face.rb Co-authored-by: ima1zumi <52617472+ima1zumi@users.noreply.github.com> --------- https://github.com/ruby/reline/commit/fdc1d3b1e5 Co-authored-by: Stan Lo <stan001212@gmail.com> Co-authored-by: ima1zumi <52617472+ima1zumi@users.noreply.github.com>
2023-08-20[ruby/reline] Use fdiv for keyseq_timeout msec to sec conversiontomoya ishida
(https://github.com/ruby/reline/pull/583) https://github.com/ruby/reline/commit/a6504acd63
2023-08-20[ruby/reline] Remove Timeout usageStan Lo
(https://github.com/ruby/reline/pull/580) Timeout's implementation relies on Thread, which would conflict with `ruby/debug`'s thread-freezing implementation and has casued issues like - ruby/debug#877 - ruby/debug#934 - ruby/debug#1000 This commit avoids the issue by completely removing the use of Timeout. https://github.com/ruby/reline/commit/d4f0cd3fe1
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-07-05[ruby/reline] Update Relin::IOGate dinamically when it is neededtomoya ishida
(https://github.com/ruby/reline/pull/560) https://github.com/ruby/reline/commit/4680d1c9e0
2023-07-04[ruby/reline] Refactor Reline::CoreStan Lo
(https://github.com/ruby/reline/pull/561) * Use Reline::Core.encoding instead of directly referencing IOGate * Set input/output based on the IOGate's interface
2023-06-20[ruby/reline] Omit constant under StructYuta Kusuno
(https://github.com/ruby/reline/pull/554) https://github.com/ruby/reline/commit/8761a11fa5
2023-05-27[ruby/reline] Use appropriate dialog height and reduce screen pushuptomoya ishida
problem (https://github.com/ruby/reline/pull/542) * Provide preferred_dialog_height for dialog positioning * Fix rendering test
2023-04-15[ruby/reline] Change Reline.add_dialog_proc(name, nil) to properlytomoya ishida
remove dialog_proc (https://github.com/ruby/reline/pull/532) https://github.com/ruby/reline/commit/43283b2f37
2023-02-27[ruby/reline] Fix the cause of test_yamatanooroti randomly failingtomoya ishida
(https://github.com/ruby/reline/pull/474) * Add repeated input-delete test that fails on HEAD * Use raw mode while readmultiline
2023-02-07[ruby/reline] Add comment for unused constantsima1zumi
FILENAME_COMPLETION_PROC and USERNAME_COMPLETION_PROC are not used by Reline. However, they were added for compatibility with the rb-readline gem. These constants have been retained and comments added. https://github.com/ruby/reline/commit/98fdbd3f18
2022-12-05[ruby/reline] Remove unapproved color setting APIsStan Lo
These APIs/configs are not approved by the Ruby core, so they can't be released to the public. This means having them in the codebase will block other fixes/features from being released as well. So this commit removes those exposed interfaces to unblock the release. Hopefully when https://bugs.ruby-lang.org/issues/18996 is approved we can re-implement better APIs. https://github.com/ruby/reline/commit/f7a961c550
2022-09-01[ruby/reline] Support dumb terminalNobuyoshi Nakada
The "dumb" terminal is considered only on MSys tty now. However, the `TERM` feature has been used on many Unix-like systems for decades, not MSys specific. https://github.com/ruby/reline/commit/53fd51ab62
2022-07-22[ruby/reline] Rename dialog_pointer_* to dialog_highlight_*st0012
"Pointer" is not what we usually use to describe a selected item. "Highlight" is a more common word for the scenario so we should use it instead. https://github.com/ruby/reline/commit/b4279d1557
2022-07-16[ruby/reline] Use color name instead of code (integer) in dialog color APIsst0012
As pointed out in the [comment](https://github.com/ruby/reline/pull/413#issuecomment-1168033973), the code is actually a control sequence and not only for colors. To make the dialog color APIs safer to use, we should restrict its usages and extract away the bg/fg concept from the input. So in this commit, I made these changes: 1. The dialog_*_bg/fg_color APIs only takes and returns color names (symbol): - :black - :red - :green - :yellow - :blue - :magenta - :cyan - :white 2. Add additional dialog_*_bg/fg_color_sequence APIs to access the raw code. https://github.com/ruby/reline/commit/b32a977766
2022-06-27[ruby/reline] Enable to change the background color of dialogs. ↵pocari
(https://github.com/ruby/reline/pull/413) https://github.com/ruby/reline/commit/bd49537964
2022-06-13[ruby/reline] Check the ambiguous char width only on ttyNobuyoshi Nakada
It sent the char to check even to non-tty, e.g., pipe. This causes `unknown command: "\xE2\x96\xBDstart ` warnings on ruby's parallel test on Windows, where non-standard FDs cannot be passed to child processes. https://github.com/ruby/reline/commit/0d373647fb
2021-12-21[ruby/reline] Finalize when exception occurredaycabta
https://github.com/ruby/reline/commit/1f8a3aee43 Co-authored-by: Alex Gittemeier <me@a.lexg.dev>
2021-12-21[ruby/reline] Split off set_signal_handler methodaycabta
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. https://github.com/ruby/reline/commit/b143c4f5f9
2021-12-20[ruby/reline] Add support for overwriting dialog proc with the same nameaycabta
https://github.com/ruby/reline/commit/16aa20c380
2021-12-20[ruby/reline] Add Reline.dialog_proc(name_sym)aycabta
https://github.com/ruby/reline/commit/7e5dbe4750
2021-10-11[ruby/reline] Suppress warning, "instance variable @ambiguous_width not ↵aycabta
initialized" https://github.com/ruby/reline/commit/368f7e2f78
2021-10-02[ruby/reline] Refactoring Reline::Key.match? and add test.manga_osyo
https://github.com/ruby/reline/commit/90e8999ae4