aboutsummaryrefslogtreecommitdiffstats
path: root/lib/reline/line_editor.rb
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/reline] Introduce a new class Reline::Face to configureHASUMI Hitoshi2023-11-061-13/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [ruby/reline] Add `kill-word` and `backward-kill-word` keymappingosyo-manga2023-07-271-0/+2
| | | | | | | | | | | | support. (https://github.com/ruby/reline/pull/570) Fix it https://github.com/ruby/reline/issues/558 https://github.com/ruby/reline/commit/0f8000443e Co-authored-by: Stan Lo <stan001212@gmail.com>
* [ruby/reline] Fix [nil] is passed to auto_indent_proc when exit withosyo-manga2023-07-181-1/+1
| | | | | | | | | | | | | | | CTRL+d (https://github.com/ruby/reline/pull/571) * Fix [nil] is passed to auto_indent_proc when exit with CTRL+d Fix it https://github.com/ruby/reline/issues/556 * not call auto_indent_proc when Ctrl+d. see: https://github.com/ruby/reline/pull/571#issuecomment-1637183195 https://github.com/ruby/reline/commit/0924f2a075
* [ruby/reline] Ignore unhandled escape sequencestomoya ishida2023-07-081-5/+10
| | | | | | | | (https://github.com/ruby/reline/pull/522) * Add unassigned escape sequence matcher to KeyStroke * Do not insert ESC and unassigned ESC+key to input buffer
* [ruby/reline] Reduce direct references to `Reline::IOGate`Stan Lo2023-07-071-0/+4
| | | | | | | | | | | | | | | | | (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
* [ruby/reline] Fix wrong byte_pointer passed to auto_indent_proctomoya ishida2023-07-051-1/+1
| | | | | | (https://github.com/ruby/reline/pull/562) https://github.com/ruby/reline/commit/4348354604
* [ruby/reline] Omit constant under StructYuta Kusuno2023-06-201-2/+2
| | | | | | (https://github.com/ruby/reline/pull/554) https://github.com/ruby/reline/commit/8761a11fa5
* [ruby/reline] Fix scrolldown condition in dialog renderingtomoya ishida2023-05-271-1/+1
| | | | | | (https://github.com/ruby/reline/pull/541) https://github.com/ruby/reline/commit/ad6faada3f
* [ruby/reline] Use appropriate dialog height and reduce screen pushuptomoya ishida2023-05-271-0/+10
| | | | | | | | | problem (https://github.com/ruby/reline/pull/542) * Provide preferred_dialog_height for dialog positioning * Fix rendering test
* [ruby/reline] Fix dialog corrupts rendering by pushing up input linetomoya ishida2023-05-071-2/+8
| | | | | | | | | | | | | | | | | | | too much (https://github.com/ruby/reline/pull/524) * Do not render dialog where it overflows screen * Dialog rendering should Scroll down only when needed * Refactor screen_y_range calculation Co-authored-by: Stan Lo <stan001212@gmail.com> --------- https://github.com/ruby/reline/commit/bc0e3d1310 Co-authored-by: Stan Lo <stan001212@gmail.com>
* [ruby/reline] Rewrite dialog renderingtomoya ishida2023-05-011-203/+141
| | | | | | | | | | | | (https://github.com/ruby/reline/pull/492) * Rewrite dialog rendering * Fix failing test of dialog with small screen * Add multiple-dialog rendering test * Add description comments for each part of render_dialog_changes
* [ruby/reline] Revert #335 (Trap TSTP to handle C-z)Carl Brasic2023-04-241-11/+0
| | | | | | | | | | | | | | | | | | | (https://github.com/ruby/reline/pull/535) This PR was an effort to address #321 (ed_quoted_insert doesn't work properly) but per the reporter it did not work correctly. Moreover, it introduced a major regression: Shell job control stopped working in all applications that use reline, notably IRB. Bash and other shells send SIGTSTP in response to C-z to implement job suspension. Handling SIGSTP opts out of this functionality. For a line oriented terminal program this should be avoided (not to mention, this behavior diverges from readline's) https://github.com/ruby/reline/commit/26383d25b8 Co-authored-by: Carl Brasic <cbrasic@drwholdings.com>
* Use `em_delete` in `key_delete` (#504)Étienne Barrié2023-04-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | * 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.
* [ruby/reline] Drop Dialog#scrollbar_pos as we can store it in aStan Lo2023-03-291-9/+9
| | | | | | | | | local variable (https://github.com/ruby/reline/pull/529) https://github.com/ruby/reline/commit/d0139975fd Co-authored-by: tomoya ishida <tomoyapenguin@gmail.com>
* [ruby/reline] Fix cursor position overruntomoya ishida2023-03-271-7/+3
| | | | | | | | | | | | | | | | (https://github.com/ruby/reline/pull/515) * Fix cursor position overrun * Remove unnecessary local variable Co-authored-by: Stan Lo <stan001212@gmail.com> --------- https://github.com/ruby/reline/commit/d4ad9b96c8 Co-authored-by: Stan Lo <stan001212@gmail.com>
* [ruby/reline] Fix: line longer than terminal width breaks renderingtomoya ishida2023-03-181-0/+1
| | | | | | (https://github.com/ruby/reline/pull/516) https://github.com/ruby/reline/commit/ae5f9b87ab
* [ruby/reline] Fix completion with multilinetomoya ishida2023-03-041-2/+2
| | | | | | (https://github.com/ruby/reline/pull/513) https://github.com/ruby/reline/commit/d76c482c5f
* [ruby/reline] Fix wrong indent number in prompt. whole_lines hastomoya ishida2023-02-271-34/+11
| | | | | | | | | | | | | duplicated line. (https://github.com/ruby/reline/pull/460) * whole_lines should consider prev_line_index, and must not duplicate last_line * Add test for lines passed to dynamic prompt proc * Refactor whole_lines parameters used in test helper * Remove whole_line's arguments
* [ruby/reline] Fix the cause of test_yamatanooroti randomly failingtomoya ishida2023-02-271-1/+1
| | | | | | | | (https://github.com/ruby/reline/pull/474) * Add repeated input-delete test that fails on HEAD * Use raw mode while readmultiline
* [ruby/reline] Fix line rendering when newline is added at the end of the buffertompng2023-02-061-5/+12
| | | | https://github.com/ruby/reline/commit/7d61b3df9a
* [ruby/reline] accept new_indent > cursor_maxtompng2023-01-201-2/+3
| | | | https://github.com/ruby/reline/commit/61cc580da4
* [ruby/reline] Add constant MINIMUM_SCROLLBAR_HEIGHT for scrollbar rendering ↵tompng2023-01-181-1/+2
| | | | | | when dialog content is very long https://github.com/ruby/reline/commit/d4c95f89ec
* [ruby/reline] Fix dialog scrollbar rendering position and disappearing bugtompng2023-01-181-4/+4
| | | | https://github.com/ruby/reline/commit/e21b69ade4
* [ruby/reline] Pass unmodifined lines(that does not include escapetomoya ishida2023-01-121-4/+8
| | | | | | | | | sequence) to check_multiline_prompt (https://github.com/ruby/reline/pull/458) * pass unmodified lines to check_multiline_prompt * Add test to check that output modified by output_modifier_proc is not passed to prompt_proc
* [ruby/reline] PR changesOtávio Schwanck dos Santos2022-09-221-1/+1
| | | | https://github.com/ruby/reline/commit/e8e8d81f47
* [ruby/reline] fix vi-operator-argOtávio Schwanck dos Santos2022-09-221-1/+1
| | | | https://github.com/ruby/reline/commit/d42cdb8f91
* [ruby/reline] Fix a typo [ci skip]Nobuyoshi Nakada2022-09-031-1/+1
| | | | https://github.com/ruby/reline/commit/33bf80e757
* [ruby/reline] Workaround for padding width with Aracritty on macOSHiroshi SHIBATA2022-09-021-1/+4
| | | | https://github.com/ruby/reline/commit/fb4136c8a7
* [ruby/reline] Remove loose operation in Dialog#render_each_dialogMau Magnaguagno2022-09-011-1/+0
| | | | https://github.com/ruby/reline/commit/a6d1c917ce
* [ruby/reline] Enable to change the background color of dialogs. ↵pocari2022-06-271-7/+5
| | | | | | (https://github.com/ruby/reline/pull/413) https://github.com/ruby/reline/commit/bd49537964
* [ruby/reline] Fix incremental search to work correctly even if not last lineaycabta2022-01-161-0/+2
| | | | https://github.com/ruby/reline/commit/21d75f6d4c
* [ruby/reline] Insert newline in the middle of buffer just after dialogaycabta2022-01-161-0/+1
| | | | https://github.com/ruby/reline/commit/0c76631132
* [ruby/reline] Combine common logic into oneaycabta2022-01-161-10/+10
| | | | https://github.com/ruby/reline/commit/5db9738f17
* [ruby/reline] Clear dialog when adding new line to end of bufferaycabta2022-01-161-0/+5
| | | | https://github.com/ruby/reline/commit/7d38454327
* [ruby/reline] Clear dialog when just_move_cursor is called with dialog at ↵aycabta2022-01-111-1/+5
| | | | | | last line https://github.com/ruby/reline/commit/05024b968e
* [ruby/reline] Escape newline(s) in dynamic promptaycabta2021-12-251-1/+1
| | | | https://github.com/ruby/reline/commit/9b209ee1ea
* [ruby/reline] Escape newline(s) in promptaycabta2021-12-251-1/+1
| | | | https://github.com/ruby/reline/commit/b545459fca
* [ruby/reline] Remove unnecessary parameteraycabta2021-12-251-11/+11
| | | | https://github.com/ruby/reline/commit/20fcd22564
* [ruby/reline] Revert "Change aliased methods to be parivete"aycabta2021-12-241-35/+35
| | | | | | | | | Ruby 2.5 doesn't support "private alias_method" idiom but Ruby on Rails 6.x still support 2.5. 😢 This reverts commit https://github.com/ruby/reline/commit/0f075f562b9b. https://github.com/ruby/reline/commit/4ecaa63b26
* [ruby/reline] Change aliased methods to be pariveteaycabta2021-12-241-35/+35
| | | | https://github.com/ruby/reline/commit/0f075f562b
* [ruby/reline] Add doc about em-kill-line macroaycabta2021-12-241-0/+4
| | | | https://github.com/ruby/reline/commit/2e46493aff
* [ruby/reline] Implement em_kill_lineaycabta2021-12-241-0/+11
| | | | https://github.com/ruby/reline/commit/9fca6ceb45
* [ruby/reline] Rename the wrong name "em-kill-line" with the correct name ↵aycabta2021-12-241-5/+5
| | | | | | "unix-line-discard" https://github.com/ruby/reline/commit/da7af35d1f
* [ruby/reline] Add doc about ed-kill-line, kill-line, em-kill-line, and ↵aycabta2021-12-241-0/+9
| | | | | | unix-line-discard https://github.com/ruby/reline/commit/586a48ffe0
* [ruby/reline] Character merging may increase the character widthaycabta2021-12-241-2/+9
| | | | | | | Even if the number of graphemes doesn't change owing to character merging, the character width may increase. https://github.com/ruby/reline/commit/fbcd5f56a7
* [ruby/reline] Add comment for a following char of combined charaycabta2021-12-241-0/+1
| | | | https://github.com/ruby/reline/commit/d465667f57
* [ruby/reline] Finalize when exception occurredaycabta2021-12-211-1/+1
| | | | | | https://github.com/ruby/reline/commit/1f8a3aee43 Co-authored-by: Alex Gittemeier <me@a.lexg.dev>
* [ruby/reline] Split off set_signal_handler methodaycabta2021-12-211-27/+30
| | | | | | | | 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
* [ruby/reline] Add support for overwriting dialog proc with the same nameaycabta2021-12-201-2/+6
| | | | https://github.com/ruby/reline/commit/16aa20c380
* [ruby/reline] Clear dialog in pastingaycabta2021-12-191-0/+1
| | | | https://github.com/ruby/reline/commit/dabf5313e0