irb 1.3.8.pre.4 → 1.3.8.pre.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/irb.gemspec +1 -1
- data/lib/irb/cmd/help.rb +2 -1
- data/lib/irb/completion.rb +13 -5
- data/lib/irb/input-method.rb +25 -7
- data/lib/irb/version.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ed4a45cab62de9a8ac9717098e2d0bc128de0a655108ebf750a955766a21090
|
4
|
+
data.tar.gz: c81a0bd1f1b05d40d3497920658abb9dae24ddceb6b41afac425eb426f43ef34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31a8eca68eec86d0f056824f30b0e788c64ca381cb79ee503c0bdd3bd44cc9a0502ce2d00a3dabc53d45b861243fd592293928cca05ae1919ccf89bcc8e4110b
|
7
|
+
data.tar.gz: a03bc92766aeb696c03d6a33113564f2649799323b1eceb6526d4abf32b0c38921aba3c1876a51c84533b3e98a2d19729354208760275f80e7169e21d651bcd1
|
data/irb.gemspec
CHANGED
data/lib/irb/cmd/help.rb
CHANGED
@@ -17,7 +17,8 @@ module IRB
|
|
17
17
|
class Help < Nop
|
18
18
|
def execute(*names)
|
19
19
|
require 'rdoc/ri/driver'
|
20
|
-
|
20
|
+
opts = RDoc::RI::Driver.process_args([])
|
21
|
+
IRB::ExtendCommand::Help.const_set(:Ri, RDoc::RI::Driver.new(opts))
|
21
22
|
rescue LoadError, SystemExit
|
22
23
|
IRB::ExtendCommand::Help.remove_method(:execute)
|
23
24
|
# raise NoMethodError in ensure
|
data/lib/irb/completion.rb
CHANGED
@@ -296,7 +296,8 @@ module IRB
|
|
296
296
|
candidates.uniq!
|
297
297
|
end
|
298
298
|
if doc_namespace
|
299
|
-
|
299
|
+
rec_class = rec.is_a?(Module) ? rec : rec.class
|
300
|
+
"#{rec_class.name}#{sep}#{candidates.find{ |i| i == message }}"
|
300
301
|
else
|
301
302
|
select_message(receiver, message, candidates, sep)
|
302
303
|
end
|
@@ -315,12 +316,19 @@ module IRB
|
|
315
316
|
end
|
316
317
|
|
317
318
|
else
|
318
|
-
candidates = eval("methods | private_methods | local_variables | instance_variables | self.class.constants", bind).collect{|m| m.to_s}
|
319
|
-
candidates |= ReservedWords
|
320
|
-
|
321
319
|
if doc_namespace
|
322
|
-
|
320
|
+
vars = eval("local_variables | instance_variables", bind).collect{|m| m.to_s}
|
321
|
+
perfect_match_var = vars.find{|m| m.to_s == input}
|
322
|
+
if perfect_match_var
|
323
|
+
eval("#{perfect_match_var}.class.name", bind)
|
324
|
+
else
|
325
|
+
candidates = eval("methods | private_methods | local_variables | instance_variables | self.class.constants", bind).collect{|m| m.to_s}
|
326
|
+
candidates |= ReservedWords
|
327
|
+
candidates.find{ |i| i == input }
|
328
|
+
end
|
323
329
|
else
|
330
|
+
candidates = eval("methods | private_methods | local_variables | instance_variables | self.class.constants", bind).collect{|m| m.to_s}
|
331
|
+
candidates |= ReservedWords
|
324
332
|
candidates.grep(/^#{Regexp.quote(input)}/)
|
325
333
|
end
|
326
334
|
end
|
data/lib/irb/input-method.rb
CHANGED
@@ -314,20 +314,34 @@ module IRB
|
|
314
314
|
end
|
315
315
|
|
316
316
|
SHOW_DOC_DIALOG = ->() {
|
317
|
+
dialog.trap_key = nil
|
318
|
+
alt_d = [
|
319
|
+
[Reline::Key.new(nil, 0xE4, true)], # Normal Alt+d.
|
320
|
+
[195, 164] # The "ä" that appears when Alt+d is pressed on xterm.
|
321
|
+
]
|
317
322
|
begin
|
318
323
|
require 'rdoc'
|
319
324
|
rescue LoadError
|
320
325
|
return nil
|
321
326
|
end
|
327
|
+
|
322
328
|
if just_cursor_moving and completion_journey_data.nil?
|
323
329
|
return nil
|
324
330
|
end
|
325
|
-
cursor_pos_to_render, result, pointer,
|
331
|
+
cursor_pos_to_render, result, pointer, autocomplete_dialog = context.pop(4)
|
326
332
|
return nil if result.nil? or pointer.nil? or pointer < 0
|
327
333
|
name = result[pointer]
|
328
334
|
name = IRB::InputCompletor.retrieve_completion_data(name, doc_namespace: true)
|
329
335
|
|
330
336
|
driver = RDoc::RI::Driver.new
|
337
|
+
|
338
|
+
if key.match?(dialog.name)
|
339
|
+
begin
|
340
|
+
driver.display_names([name])
|
341
|
+
rescue RDoc::RI::Driver::NotFoundError
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
331
345
|
begin
|
332
346
|
name = driver.expand_name(name)
|
333
347
|
rescue RDoc::RI::Driver::NotFoundError
|
@@ -355,13 +369,17 @@ module IRB
|
|
355
369
|
end
|
356
370
|
end
|
357
371
|
return nil if doc.nil?
|
372
|
+
width = 40
|
358
373
|
formatter = RDoc::Markup::ToAnsi.new
|
359
|
-
formatter.width =
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
374
|
+
formatter.width = width
|
375
|
+
dialog.trap_key = alt_d
|
376
|
+
message = 'Press Alt+d to read the full document'
|
377
|
+
contents = [message] + doc.accept(formatter).split("\n")
|
378
|
+
|
379
|
+
x = cursor_pos_to_render.x + autocomplete_dialog.width
|
380
|
+
x = autocomplete_dialog.column - width if x + width >= screen_width
|
381
|
+
y = cursor_pos_to_render.y
|
382
|
+
DialogRenderInfo.new(pos: Reline::CursorPos.new(x, y), contents: contents, width: width, bg_color: '49')
|
365
383
|
}
|
366
384
|
|
367
385
|
# Reads the next line from this input method.
|
data/lib/irb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.8.pre.
|
4
|
+
version: 1.3.8.pre.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiju ISHITSUKA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reline
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.2.8.pre.
|
19
|
+
version: 0.2.8.pre.8
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.2.8.pre.
|
26
|
+
version: 0.2.8.pre.8
|
27
27
|
description: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
|
28
28
|
email:
|
29
29
|
- keiju@ruby-lang.org
|