summaryrefslogtreecommitdiff
path: root/lib/irb/input-method.rb
AgeCommit message (Collapse)Author
2023-08-09[ruby/irb] Fix nested IRB sessions' history savingStan Lo
(https://github.com/ruby/irb/pull/652) 1. Dynamically including `HistorySavingAbility` makes things unnecessarily complicated and should be avoided. 2. Because both `Reline` and `Readline` use a single `HISTORY` constant to store history data. When nesting IRB sessions, only the first IRB session should handle history loading and saving so we can avoid duplicating history. 3. History saving callback should NOT be stored in `IRB.conf` as it's recreated every time `IRB.setup` is called, which would happen when nesting IRB sessions. https://github.com/ruby/irb/commit/0fef0ae160
2023-08-07[ruby/irb] Remove unused `InputMethod#initialize`Stan Lo
(https://github.com/ruby/irb/pull/635) * Remove unused InputMethod#initialize The constructor takes a `file_name` argument, but it is never used. The only input method that needs a file is `FileInputMethod`, which has its own constructor to take a file object directly. So the constructor in `InputMethod` is not needed and its child classes don't need to call `super` in their constructors. * Remove unused FileInputMethod#file_name https://github.com/ruby/irb/commit/153b1e9d1c
2023-08-02[ruby/irb] Drop src_encoding.rbStan Lo
(https://github.com/ruby/irb/pull/634) Its method `IRB.default_src_encoding` was only used in `magic-file.rb`, which has been removed. https://github.com/ruby/irb/commit/ed98983b1f
2023-07-14[ruby/irb] Fix history-saving featureStan Lo
(https://github.com/ruby/irb/pull/642) * Define RelineInputMethod::HISTORY The HistorySavingAbility module doesn't do anything if the input method class doesn't define HISTORY. - https://github.com/ruby/irb/blob/3ac96be660bf052902fb4e532c7a46cf294b71eb/lib/irb/history.rb#L10 - https://github.com/ruby/irb/blob/3ac96be660bf052902fb4e532c7a46cf294b71eb/lib/irb/history.rb#L34 This patch defines RelineInputMethod::HISTORY to avoid this. * Improve history-saving's ability check Instead of checking the existence of `input_method_class::HISTORY`, we should make every input method class declare if it supports history saving or not. Since the default value is `false`, it shouldn't break any custom input method that inherits from `IRB::InputMethod`. https://github.com/ruby/irb/commit/aec7a5b3f5
2023-07-12[ruby/irb] Correct preferred_dialog_height's callerStan Lo
(https://github.com/ruby/irb/pull/638) The caller should be the dialog itself, not Reline. https://github.com/ruby/irb/commit/418c2b945e
2023-07-11[ruby/irb] Require Reline 0.3.6 or higherima1zumi
(https://github.com/ruby/irb/pull/632) * Require Reline 0.3.6 or higher "Multi-line multibyte regular expression raises exception" (https://github.com/ruby/irb/issues/627) is fixed in Reline 0.3.6. * Remove unnecessary conditional
2023-07-09[ruby/irb] Avoid using Reline as a moduleStan Lo
(https://github.com/ruby/irb/pull/633) Using it as a module makes it harder to understand methods' source.
2023-05-28[ruby/irb] Set maximum document dialog height bytomoya ishida
preferred_dialog_height provided by Reline (https://github.com/ruby/irb/pull/591) https://github.com/ruby/irb/commit/df6907aca9
2023-05-19[ruby/irb] Display mod key as `Option` on Darwin platformsAdam Daniels
(https://github.com/ruby/irb/pull/584) Check RUBY_PLATFORM for `darwin` and modify the mod key from `Alt` to `Option`.
2023-04-28[ruby/irb] Retire magic-file.rbStan Lo
(https://github.com/ruby/irb/pull/574) `MagicFile` was introduced around v0.9.6, which was like 14~15 years ago. It was needed because back then we needed to read a file's magic comment to determine the encoding of it, and read it with that encoding. Commit: 3ee79e89 But now we expect files to be encoded in UTF-8 and don't specify encoding through magic comments anymore, `MagicFile` can be retired.
2023-01-11[ruby/irb] Formatting to header stylesHiroshi SHIBATA
https://github.com/ruby/irb/commit/cef125850d
2023-01-11[ruby/irb] Removed Release Version and Revisions for old VCS softwareHiroshi SHIBATA
https://github.com/ruby/irb/commit/07fae94862
2022-11-15[ruby/irb] Rename leftover Reidline referencesst0012
https://github.com/ruby/irb/commit/0ed8b103ed
2022-10-24[ruby/irb] Move require out of repeated execution pathst0012
SHOW_DOC_DIALOG will be called repeatedly whenever the corresponding key is pressed, but we only need to require rdoc once. So ideally the require can be put outside of the proc. And because when rdoc is not available the entire proc will be nonfunctional, we can stop registering the SHOW_DOC_DIALOG if we failed to require rdoc. https://github.com/ruby/irb/commit/b1278b7320
2022-10-18[ruby/irb] Always use local variables in current context to parse code ↵tomoya ishida
(https://github.com/ruby/irb/pull/397) * Use local_variables for colorize, code_block_open check, nesting_level and assignment_expression check * Check if expression is an assignment BEFORE evaluating it. evaluate might define new localvars and change result of assignment_expression? * Add local_variables dependent code test * pend local variable dependent test on truffleruby code_block_open is not working on truffleruby * Always pass context to RubyLex#lex * Rename local_variable_assign_code generator method name * Add assignment expression truncate test * Add Context#local_variables and make generate_local_variables_assign_code more simple * Update lib/irb/input-method.rb Co-authored-by: Stan Lo <[email protected]> * Add a comment why assignment expression check should be done before evaluate https://github.com/ruby/irb/commit/c8b3877281 Co-authored-by: Stan Lo <[email protected]> Co-authored-by: Takashi Kokubun <[email protected]>
2022-10-05[ruby/irb] Rename IDB::ReidlineInputMethod to IRB::RelineInputMethodGannon McGibbon
Deprecates IDB::ReidlineInputMethod and USE_REIDLINE in favor of IRB::RelineInputMethod and USE_RELINE. The Input method uses Reline to read input from the console, so it can be named directly after the Reline library like other inputs methods are (Readline, Stdio, etc.). https://github.com/ruby/irb/commit/5bcade7130
2022-09-17[ruby/irb] Support --noscript option to not use first non-option argument as ↵Jeremy Evans
script Also add --script option to turn the option back on. Previously there wasn't a way to get an interactive IRB session and access arguments provided on the command line. Additionally, handle `-` as script as stdin. In Unix-like tools, `-` means to take standard input instead of a file. This doesn't result in exactly the same output for: ``` echo 'p ARGV' > args.rb; irb args.rb a b c ``` and ``` echo 'p ARGV' | irb - a b c ``` Due to how irb handles whether stdin is a tty. However, this change allows use of `-` as a argument, instead of giving an unrecognized switch error. This required some small changes to context.rb (to handle `-` as standard input) and input-method.rb (to have FileInputMethod accept IO arguments in addition to strings). Implements [Feature #15371] https://github.com/ruby/irb/commit/4192683ba2
2022-08-26[ruby/irb] Require RDoc in `input-method.rb` again in a limited scope.Jun Aruga
RDoc is implemented as soft dependency in IRB. See how the rdoc is required in the files. I reverted the commit below. ``` $ grep -ril rdoc lib/ lib/irb/cmd/help.rb lib/irb/completion.rb lib/irb/easter-egg.rb lib/irb/input-method.rb ``` --- Revert "Remove `require` in signal handler to avoid ThreadError" This reverts commit https://github.com/ruby/irb/commit/5f749c613c89. https://github.com/ruby/irb/commit/b24852058f
2022-08-23[ruby/irb] Drop hard dependency on RDoc.Vít Ondruch
This has been introduced in https://github.com/ruby/irb/commit/026700499dfd, but it seems that this is just be mistake, otherwise the later handling of `LoadError` would not be needed. https://github.com/ruby/irb/commit/54c8df06ff
2022-06-26[ruby/irb] Ensure stdout is a TTY before calling winsizePeter Jones
When outputting a (possibly truncated) value, IRB will query the window size. However, if IRB was piped to another process, stdout will no longer be a TTY and will not support the `winsize` method. This fix ensure that stdout is a TTY. https://github.com/ruby/irb/commit/125de5eeea
2021-12-29[ruby/irb] Prefer `IO#wait_readable` over `IO#select`. ↵Samuel Williams
(https://github.com/ruby/irb/pull/323) https://github.com/ruby/irb/commit/1c03bd3373
2021-12-25[ruby/irb] Support showing doc by dialog in iTerm2aycabta
https://github.com/ruby/irb/commit/a4b95d6634
2021-12-03[ruby/irb] Add Alt+d keycode when convert-meta isn't usedima1zumi
I pushed reline#389 for when convert-meta is not turned on in .inputrc. Alt+D in irb also needs to be set to the keycode for not using convert-meta. https://github.com/ruby/irb/commit/328eddf851
2021-10-11[ruby/irb] Add --extra-doc-dir option to show doc dialogaycabta
https://github.com/ruby/irb/commit/3f79cb506f
2021-10-08[ruby/irb] Determine left and right when the width of either side is zero ↵aycabta
correctly https://github.com/ruby/irb/commit/5df6e1f027
2021-10-08[ruby/irb] Calculate right side doc dialog width correctlyaycabta
https://github.com/ruby/irb/commit/f34da7fa04
2021-10-08[ruby/irb] Specify whether to show the doc dialog on the left or right side ↵aycabta
by using variable names https://github.com/ruby/irb/commit/a23a88b8c9
2021-10-08[ruby/irb] Display doc dialog in gaps on narrow screenaycabta
https://github.com/ruby/irb/commit/4d7cefcaa4
2021-10-07[ruby/irb] Update descriptions of methodsKaíque Kandy Koga
From Reidline to Reline Update description used in take_corresponding_syntax_to_kw_do and is_the_in_correspond_to_a_for methods Use possessive noun correctly Second element https://github.com/ruby/irb/commit/4fa9714d6f
2021-10-03[ruby/irb] Remove `require` in signal handler to avoid ThreadErrorMasataka Pocke Kuwabara
`rdoc` has been required so it looks unnecessary https://github.com/ruby/irb/commit/5f749c613c
2021-09-06[ruby/irb] Add comments for Alt+d key sequencesaycabta
https://github.com/ruby/irb/commit/4cb5f7e546
2021-09-06[ruby/irb] Use multiple trap_keyaycabta
https://github.com/ruby/irb/commit/416abe2524
2021-09-04[ruby/irb] Remove commeted out codeaycabta
https://github.com/ruby/irb/commit/7dda1f803e
2021-09-04[ruby/irb] Show doc at the same height as the autocompletion dialogaycabta
https://github.com/ruby/irb/commit/a9db71e6bc
2021-09-04[ruby/irb] Render properly if both autocomplete and show doc dialogs are ↵aycabta
left of the cursor https://github.com/ruby/irb/commit/0090203107
2021-09-03[ruby/irb] Use Reline::Key for trap_key in dialog callbackaycabta
https://github.com/ruby/irb/commit/b05ce3c72d
2021-09-03[ruby/irb] Add message to show full docaycabta
https://github.com/ruby/irb/commit/6370a5d974
2021-09-03[ruby/irb] Add Alt+d trap from show doc dialog to show full docaycabta
https://github.com/ruby/irb/commit/368327b082
2021-08-31[ruby/irb] Set the dialog width to render with a fixed widthaycabta
https://github.com/ruby/irb/commit/80c4329643
2021-08-31[ruby/irb] Follow that Dialog#contents_width has been renamed to #widthaycabta
https://github.com/ruby/irb/commit/49a73d929e
2021-08-31[ruby/irb] Make show doc dialog appears on the left at the right edgeaycabta
https://github.com/ruby/irb/commit/6480eddd31
2021-08-31[ruby/irb] Rename a variable "dialog" with "autocomplete_dialog"aycabta
Because it's just used to receive data from the autocomplete dialog, not for show doc dialog. https://github.com/ruby/irb/commit/f8b752bd98
2021-08-31[ruby/irb] Use DialogRenderInfoaycabta
https://github.com/ruby/irb/commit/5bc3a72ca3
2021-08-31[ruby/irb] Take dialog to get scroll_topaycabta
https://github.com/ruby/irb/commit/7209082a11
2021-08-31[ruby/irb] Don't show doc when pointer is negativeaycabta
https://github.com/ruby/irb/commit/48af34bfc2
2021-08-30[ruby/irb] [].name to display the doc for Array.nameaycabta
https://github.com/ruby/irb/commit/7c2abc14d8
2021-08-30[ruby/irb] Rescue unknown error to quash crashingaycabta
https://github.com/ruby/irb/commit/92cce941cb
2021-08-30Add --autocomplete / --noautocomplete optionsaycabta
2021-08-29[ruby/irb] Rescue NotFoundError of RDoc::RI::Driver#expand_nameaycabta
https://github.com/ruby/irb/commit/c5f13b23d7
2021-08-29[ruby/irb] Add show doc dialog for Relineaycabta
https://github.com/ruby/irb/commit/026700499d