Commit graph

663 commits

Author SHA1 Message Date
Samuel Williams
e4cd319f3d [ruby/irb] Prefer IO#wait_readable over IO#select. (https://github.com/ruby/irb/pull/323)
1c03bd3373
2021-12-29 09:37:05 +09:00
aycabta
0f1fbc6421 [ruby/irb] Version 1.4.1
b1d9c34441
2021-12-25 12:57:28 +09:00
aycabta
ddf0cdee4f [ruby/irb] Support showing doc by dialog in iTerm2
a4b95d6634
2021-12-25 12:56:40 +09:00
aycabta
90239c4163 [ruby/irb] Version 1.4.0
b80ec5821e
2021-12-25 00:41:04 +09:00
aycabta
214b6128ae [ruby/irb] Update dependency, reline >= 0.3.0
f36ad549c4
2021-12-25 00:41:03 +09:00
manga_osyo
f279d41847 Fix warning in Lexer::Elem#[]
Changed to use `#pos` `#event` `#tok` `#state` since using Lexer::Elem#[0~4] now gives a warning.
see: 8944009be7

9adbb9af32
2021-12-24 20:44:02 +09:00
YO4
de0523fedd [ruby/irb] irb_info codepage mismatch
`chcp` returns different encoding

f80971994a
2021-12-24 10:32:14 +09:00
aycabta
b96ef7684c [ruby/irb] Add East Asian Ambiguous Width to irb_info command
4cade4b7e5
2021-12-20 16:19:36 +09:00
Kaíque Kandy Koga
6b64e78823 [ruby/irb] Examine indentation of in keyword when trying to type include
Use in_keyword_case_scope?

Return fast

8acc7f8dc7
2021-12-03 00:56:43 +09:00
ima1zumi
d486286f1d [ruby/irb] Add Alt+d keycode when convert-meta isn't used
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.

328eddf851
2021-12-03 00:51:41 +09:00
manga_osyo
dcbe29d2ae [ruby/irb] Fix bug infinite loop when pasting multilines fo code in Ruby 2.6
Fix bug infinite loop when pasting multilines fo code in Ruby 2.6.
This is not reproduced in Ruby 2.7.
Changes added in https://github.com/ruby/irb/pull/242/files#diff-612b926e42ed78aed1a889ac1944f7d22229b3a489cc08f837a7f75eca3d3399R155 are also reflected in Ruby 2.6.

0a77f75bf0
2021-12-03 00:42:28 +09:00
schneems
2b22c93533 Compatibility with IRB
Instead of accessing the struct as an array, access it via methods. There are other places inside of this file already using this API (for example e0a5c3d2b7/lib/irb/ruby-lex.rb (L829-L830)).

This commit moves all struct array-ish calls to use their method calls instead. It is also ~1.23 faster accessing values via a method instead of as an array according to this microbenchmark:

```ruby
Elem = Struct.new(:pos, :event, :tok, :state, :message) do
  def initialize(pos, event, tok, state, message = nil)
    super(pos, event, tok, State.new(state), message)
  end

  # ...

  def to_a
    a = super
    a.pop unless a.empty?
    a
  end
end

class ElemClass
  attr_accessor :pos, :event, :tok, :state, :message

  def initialize(pos, event, tok, state, message = nil)
    @pos = pos
    @event = event
    @tok = tok
    @state = State.new(state)
    @message = message
  end

  def to_a
    if @message
      [@pos, @event, @tok, @state, @message]
    else
      [@pos, @event, @tok, @state]
    end
  end
end

# stub state class creation for now
class State; def initialize(val); end; end
```

```ruby
Benchmark.ips do |x|
  x.report("struct") { struct[1] }
  x.report("class ") { from_class.event }
  x.compare!
end; nil
```

```
Warming up --------------------------------------
              struct     1.624M i/100ms
              class      1.958M i/100ms
Calculating -------------------------------------
              struct     17.139M (± 2.6%) i/s -     86.077M in   5.025801s
              class      21.104M (± 3.4%) i/s -    105.709M in   5.015193s

Comparison:
              class : 21103826.3 i/s
              struct: 17139201.5 i/s - 1.23x  (± 0.00) slower
```
2021-12-02 15:55:42 +09:00
Kaíque Kandy Koga
5c646ca0a0 [ruby/irb] Ignore parenthesis during completion
Rename method

619aecb412
2021-10-13 06:33:48 +09:00
aycabta
7732052718 [ruby/irb] Add help about extra doc dir option
5018f2cb99
2021-10-11 21:12:58 +09:00
aycabta
866a09dd9e [ruby/irb] Add --extra-doc-dir option to show doc dialog
3f79cb506f
2021-10-11 21:12:57 +09:00
aycabta
dcaaf79ca0 [ruby/irb] Add periods to doc
6330601629
2021-10-11 20:34:18 +09:00
aycabta
340fabca2c [ruby/irb] Set default return_format
7ee15bc668
2021-10-11 15:39:48 +09:00
Takashi Kokubun
cf74755921 [ruby/irb] Revert "Optimize show_source command further"
This reverts commit 27dd2867cda5c789efaa5078214ad2fd82adcebf.

This is to fix the test I added.

(I separated commits to test a new behavior of ruby-commit-hook)

fe055d521a
2021-10-10 23:23:18 -07:00
aycabta
5805b1472a [ruby/irb] Version 1.3.8.pre.11
49b9f644c2
2021-10-09 23:29:29 +09:00
aycabta
98d9a7e435 [ruby/irb] Update dependency, reline >= 0.2.8.pre.11
4f686afbca
2021-10-09 23:29:24 +09:00
aycabta
1507cb084c [ruby/irb] Determine left and right when the width of either side is zero correctly
5df6e1f027
2021-10-08 10:34:06 +09:00
aycabta
576eccf76d [ruby/irb] Calculate right side doc dialog width correctly
f34da7fa04
2021-10-08 10:33:56 +09:00
aycabta
374efa8e30 [ruby/irb] Specify whether to show the doc dialog on the left or right side by using variable names
a23a88b8c9
2021-10-08 10:33:47 +09:00
aycabta
5c02df8296 [ruby/irb] Display doc dialog in gaps on narrow screen
4d7cefcaa4
2021-10-08 10:33:39 +09:00
Kaíque Kandy Koga
80e2242da6 [ruby/irb] Update descriptions of methods
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

4fa9714d6f
2021-10-07 23:55:54 +09:00
Jeremy Evans
896626fa02 [ruby/irb] Make IRB::Context#exit call super if UncaughtThrowError
Fixes calling exit after binding.irb.

Fixes [Bug #18234]

4ea8d376f2
2021-10-07 23:53:58 +09:00
Masataka Pocke Kuwabara
853ca5cceb [ruby/irb] Remove require in signal handler to avoid ThreadError
`rdoc` has been required so it looks unnecessary

5f749c613c
2021-10-03 21:51:54 +09:00
aycabta
208b7b8199 [ruby/irb] Version 1.3.8.pre.10
15bcbbb284
2021-10-03 21:50:30 +09:00
aycabta
a5c58e88de [ruby/irb] Update dependency, reline >= 0.2.8.pre.10
800e83eabd
2021-10-03 21:50:26 +09:00
aycabta
00cfafc0f5 [ruby/irb] Add doc about "echo on assignment"
5af637b3c1
2021-09-27 03:23:48 +09:00
aycabta
51773bed10 [ruby/irb] Add blank lines to sample code in doc for readability
123b7e53ee
2021-09-27 03:23:41 +09:00
aycabta
2ae64bf6b9 [ruby/irb] Fix sample code in doc
642adbe968
2021-09-27 03:23:37 +09:00
aycabta
5c0636bda4 [ruby/irb] Add a space before left paren
973bac83ff
2021-09-27 03:23:31 +09:00
aycabta
ff26c60bc1 [ruby/irb] Revert "Show original string byte sequence to debug"
This reverts commit b42fe5937a.

b22094a16f
2021-09-24 23:50:32 +09:00
aycabta
93291005a0 [ruby/irb] Show original string byte sequence to debug
7a97bb0e56
2021-09-24 23:50:26 +09:00
aycabta
4704bc0976 Revert "Show original string byte sequence to debug"
This reverts commit b42fe5937a.
2021-09-23 18:02:21 +09:00
Nobuyoshi Nakada
ede95f541b [ruby/irb] Ignore any encoding errors while symbol completion
daa65cded1
2021-09-23 18:01:36 +09:00
aycabta
b42fe5937a Show original string byte sequence to debug 2021-09-23 16:21:06 +09:00
Kaíque Kandy Koga
782d1d876b [ruby/irb] Use typed spaces when the line is inside the here documents
Use first method instead of square brackets to support 2.5 and 2.6 versions

Use tokens

Clear check_newline_depth_difference

6fec2a5d46
2021-09-22 23:26:41 +09:00
Nobuyoshi Nakada
ee53d97b16 [ruby/irb] Sort shortest files in each load paths
There are two directories where csv*/**/*.rb exist, lib/ and
test/, and depending on the order of tests, test/ may be placed
before lib/.  In that case, as "shortest" names were not sorted,
csv/helper.rb will be the first candidate for "csv".

2af7c6bf71
2021-09-21 23:28:14 +09:00
Nobuyoshi Nakada
c94718e39f [ruby/irb] Check if Gem::Specification is defined
005ade74dd
2021-09-21 23:28:09 +09:00
aycabta
3e038ab1c7 [ruby/irb] Ignore invalid 3 colons in completion
5e29e3e39c
2021-09-11 04:41:20 +09:00
aycabta
01a364a36a [ruby/irb] Version 1.3.8.pre.9
4781f67fb8
2021-09-10 11:01:33 +09:00
aycabta
e02bbe469b [ruby/irb] Update dependency, reline >= 0.2.8.pre.9
ab5d84c55b
2021-09-10 11:01:27 +09:00
aycabta
90afe5f11f [ruby/irb] Move IRB::TOPLEVEL_BINDING from exe/irb to lib/irb/workspace.rb
e736a77076
2021-09-10 06:37:07 +09:00
Marc-Andre Lafortune
3503c94af5 [ruby/irb] Avoid loading files' local variables [Bug #17623]
b12f0cb8e2
2021-09-10 06:37:06 +09:00
aycabta
f085a6fb69 [ruby/irb] Support symbol with backtick
0aa2425883
2021-09-10 04:59:17 +09:00
aycabta
bc24af0f35 [ruby/irb] Show lib name first because it's the most common use case
74d635758b
2021-09-08 05:23:56 +09:00
aycabta
c5e8088c7e [ruby/irb] Define absolute_path? by myself for backward compatibility
d9c0dc043e
2021-09-08 05:23:50 +09:00
aycabta
04984415a5 [ruby/irb] Use gem paths to complete "require"
c870b23455
2021-09-08 05:23:45 +09:00