Commit graph

121 commits

Author SHA1 Message Date
aycabta
991eb4894d [ruby/irb] Use multiple trap_key
416abe2524
2021-09-06 05:24:41 +09:00
aycabta
5f771f4f02 [ruby/irb] Remove commeted out code
7dda1f803e
2021-09-04 21:59:39 +09:00
aycabta
c8bf45f23c [ruby/irb] Show doc at the same height as the autocompletion dialog
a9db71e6bc
2021-09-04 21:57:11 +09:00
aycabta
f7d9dd2e4c [ruby/irb] Render properly if both autocomplete and show doc dialogs are left of the cursor
0090203107
2021-09-04 21:55:55 +09:00
aycabta
3d6a475587 [ruby/irb] Use Reline::Key for trap_key in dialog callback
b05ce3c72d
2021-09-03 04:28:53 +09:00
aycabta
eb92d7c732 [ruby/irb] Add message to show full doc
6370a5d974
2021-09-03 04:28:32 +09:00
aycabta
f793f68264 [ruby/irb] Add Alt+d trap from show doc dialog to show full doc
368327b082
2021-09-03 04:28:27 +09:00
aycabta
817694481c [ruby/irb] Set the dialog width to render with a fixed width
80c4329643
2021-08-31 15:20:34 +09:00
aycabta
077bc98ce4 [ruby/irb] Follow that Dialog#contents_width has been renamed to #width
49a73d929e
2021-08-31 15:20:27 +09:00
aycabta
a8e6a850d5 [ruby/irb] Make show doc dialog appears on the left at the right edge
6480eddd31
2021-08-31 15:20:22 +09:00
aycabta
cf0ece810a [ruby/irb] Rename a variable "dialog" with "autocomplete_dialog"
Because it's just used to receive data from the autocomplete dialog, not
for show doc dialog.

f8b752bd98
2021-08-31 15:20:17 +09:00
aycabta
c63d98b401 [ruby/irb] Use DialogRenderInfo
5bc3a72ca3
2021-08-31 05:24:55 +09:00
aycabta
b30be9f222 [ruby/irb] Take dialog to get scroll_top
7209082a11
2021-08-31 05:24:45 +09:00
aycabta
16cf2ef6f2 [ruby/irb] Don't show doc when pointer is negative
48af34bfc2
2021-08-31 05:24:36 +09:00
aycabta
aeec02d7f3 [ruby/irb] [].name to display the doc for Array.name
7c2abc14d8
2021-08-30 11:58:56 +09:00
aycabta
1e2f10e8aa [ruby/irb] Rescue unknown error to quash crashing
92cce941cb
2021-08-30 11:58:51 +09:00
aycabta
ece4ed0da7 Add --autocomplete / --noautocomplete options 2021-08-30 02:45:13 +09:00
aycabta
cde84a5baa [ruby/irb] Rescue NotFoundError of RDoc::RI::Driver#expand_name
c5f13b23d7
2021-08-29 20:30:01 +09:00
aycabta
ae4e301d5d [ruby/irb] Add show doc dialog for Reline
026700499d
2021-08-29 20:29:54 +09:00
aycabta
ab89c45b90 [ruby/irb] Evaluate each toplevel statement
bc1b1d8bc3
2021-04-03 01:17:08 +09:00
Cody Cutrer
3cab8c087f [ruby/irb] process multi-line pastes as a single entity
this allows pasting leading-dot chained methods correctly:

```ruby
class A
  def a; self; end
  def b; true; end
end

a = A.new

a
 .a
 .b
```

will properly return `true` instead of erroring on the `.a` line:

```
irb(main):001:1*     class A
irb(main):002:1*       def a; self; end
irb(main):003:0>     end
irb(main):004:0*
irb(main):005:0>     a = A.new
irb(main):006:0*
irb(main):007:0>     a
irb(main):008:0>      .a
irb(main):009:0>      .a
=> #<A:0x00007f984211fbe8>
```

45aeb52575
2021-04-03 00:49:29 +09:00
aycabta
0927756e58 [ruby/irb] Complete require and require_relative
1c61178b4c
2021-03-24 15:11:41 +09:00
Nobuhiro IMAI
5b05b85d85 [ruby/irb] add IRB::FileInputMethod.open to ensure closing associated File
* tweak some methods not to raise exception after `#close`
* use it in `IRB::IrbLoader#{source_file,load_file}

ec2947acbd
2021-01-27 15:01:57 +09:00
aycabta
28e9344fa4 [ruby/irb] Change StdioInputMethod#eof? to non-blocking
This fixes --inf-ruby-mode.

0e4a818955
2020-12-23 22:08:30 +09:00
aycabta
e468d9f49c [ruby/irb] Add OMIT_ON_ASSIGNMENT
Omit the results evaluated at assignment if they are too long.

The behavior of ECHO_ON_ASSIGNMENT being on by default is hard to understand,
so I change it to off by default. Instead, we turn OMIT_ON_ASSIGNMENT on by
default. The result is displayed on assignment, but it will always be short
and within one line of the screen.

c5ea79d5ce
2020-09-14 02:13:11 +09:00
aycabta
b3f84b4a5b [ruby/irb] Expand path to run separated test correctly
be2937abd5
2020-08-18 14:38:01 +09:00
Nobuyoshi Nakada
6aa786b8a3 [ruby/irb] Get rid of loading readline unnecessarily
420e7d2270
2020-08-18 14:38:01 +09:00
aycabta
3864fbc6d8 [ruby/irb] Check existence of rc files in irb_info command
cdbb9dfc9f
2020-04-29 19:13:14 +09:00
aycabta
98a346d065 [ruby/irb] Add irb_info command
a6fe58e916
2020-04-29 19:13:14 +09:00
aycabta
8c3efa4940 Use Reline.encoding_system_needs if exists 2020-01-14 15:40:38 +09:00
aycabta
ad6837dd60 [ruby/irb] Revert "Reidline mode needs Reline what needs String#grapheme_clusters"
This reverts commit 2b0b19b87c60d2cdb329979acbb96e12a1f940e7.

New IRB parser needs new Ripper what has lex_state too. The new Ripper is
adopted by Ruby 2.5 or later.

9ab6e35a2c
2019-12-07 21:55:31 +09:00
aycabta
c2afddccb3 [ruby/irb] Reidline mode needs Reline what needs String#grapheme_clusters
2b0b19b87c
2019-12-07 20:01:53 +09:00
aycabta
f8cc05dec3 Use @eof variable for ReidlineInputMethod#eof?
"IRB::InputMethod#eof?" requires eof status each user input but
"ReidlineInputMethod#eof?" used "Reline.eof?" what is singleton data.
"ReidlineInputMethod#eof?" is changed to use the result of user input.
2019-11-30 11:20:39 +09:00
aycabta
8b20829396 Remove an unnecessary variable 2019-11-26 19:22:38 +09:00
aycabta
51ea1abb5f Remove e2mmap dependency 2019-11-25 05:38:09 +09:00
aycabta
d009e321a0 Use IRB.conf[:AUTO_INDENT] setting in multiline mode 2019-06-19 09:19:41 +09:00
aycabta
235e72f17e Implement auto indent for multiline 2019-06-18 20:58:18 +09:00
aycabta
f80771f0a9 Use Reline.prompt_proc in IRB 2019-06-14 08:26:06 +09:00
Takashi Kokubun
cb40a21da0
Warn compile_error only when input is finished
Let's say we are in progress to write `"foo"`:

```
irb> "fo
```

at this moment, nothing is wrong.
It would be just a normal way to write `"foo"`.

Prior to this commit, the `fo` part was warned because of
5b64d7ac6e. But I think warning such a
normal input is not valuable for users.

However, we'd like to warn `:@1` or `@@1` which is also a syntax error.
Then this commit switches the syntax highlight based on whether the
input text is finished or not. When it's not finished yet, it does not
warn compile_error.
2019-05-31 06:54:00 +09:00
aycabta
9840f52c77 Use IRB::InputMethod#eof? to quit 2019-05-27 10:18:09 +09:00
Takashi Kokubun
e2db9f4cc3
Add and use Reline::Unicode.escape_for_print 2019-05-25 07:10:09 -07:00
Takashi Kokubun
e691b4da5d
Respect --nocolorize on REPL source highlight 2019-05-25 06:31:13 -07:00
Takashi Kokubun
b83119be9e
Incremental syntax highlight for IRB source lines
Closes: https://github.com/ruby/ruby/pull/2202
2019-05-24 23:54:52 -07:00
aycabta
559dca509d Show documents when completion 2019-05-25 03:30:01 +09:00
aycabta
260235ce87 Use Reline as Reidline multiline editor in IRB 2019-05-25 02:16:19 +09:00
Nobuyoshi Nakada
f4f66bd11c
Revert "IRB is improved with Reline and RDoc, take 2"
Accidentally merged when 89271d4a37
"Adjusted indents".
2019-04-23 21:55:29 +09:00
aycabta
f2cd4f4cd0
IRB is improved with Reline and RDoc, take 2 2019-04-23 20:08:02 +09:00
aycabta
51cec00953 Revert "IRB is improved with Reline and RDoc"
This reverts commit 7f273ac6d0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-21 09:13:49 +00:00
aycabta
7f273ac6d0 IRB is improved with Reline and RDoc
Reline is a readline stdlib compatible library. It also supports
multiline input. IRB is improved with Reline and supports multiline.
Besides, supports showing documents when completed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-20 08:51:20 +00:00
marcandre
b9d42af0f2 lib/*: Prefer require_relative over require, remove explicit extension
[#15206] [Fix GH-1976]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-02 17:52:43 +00:00