fxri 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/fxri.gemspec +24 -24
- data/lib/fxirb.rb +123 -72
- metadata +12 -12
data/fxri.gemspec
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
#!/bin/env ruby
|
2
|
-
require 'rubygems'
|
3
|
-
|
4
|
-
spec = Gem::Specification.new do |s|
|
5
|
-
s.name = "fxri"
|
6
|
-
s.add_dependency('fxruby', '>= 1.2.0')
|
7
|
-
s.version = "0.
|
8
|
-
s.date = "2005-02-20"
|
9
|
-
s.summary = "Graphical interface to the RI documentation, with search engine."
|
10
|
-
s.require_paths = ["lib"]
|
11
|
-
s.email = "martin.ankerl@gmail.com"
|
12
|
-
s.homepage = "http://fxri.rubyforge.org/"
|
13
|
-
s.rubyforge_project = "fxri"
|
14
|
-
s.description = "FxRi is an FXRuby interface to the RI documentation, with a search engine that allows for search-on-typing."
|
15
|
-
s.has_rdoc = false
|
16
|
-
s.files = Dir.glob("**/*")
|
17
|
-
s.bindir = "."
|
18
|
-
s.executables = ["fxri"]
|
19
|
-
end
|
20
|
-
|
21
|
-
if __FILE__ == $0
|
22
|
-
Gem.manage_gems
|
23
|
-
Gem::Builder.new(spec).build
|
24
|
-
end
|
1
|
+
#!/bin/env ruby
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
spec = Gem::Specification.new do |s|
|
5
|
+
s.name = "fxri"
|
6
|
+
s.add_dependency('fxruby', '>= 1.2.0')
|
7
|
+
s.version = "0.2.0"
|
8
|
+
s.date = "2005-02-20"
|
9
|
+
s.summary = "Graphical interface to the RI documentation, with search engine."
|
10
|
+
s.require_paths = ["lib"]
|
11
|
+
s.email = "martin.ankerl@gmail.com"
|
12
|
+
s.homepage = "http://fxri.rubyforge.org/"
|
13
|
+
s.rubyforge_project = "fxri"
|
14
|
+
s.description = "FxRi is an FXRuby interface to the RI documentation, with a search engine that allows for search-on-typing."
|
15
|
+
s.has_rdoc = false
|
16
|
+
s.files = Dir.glob("**/*")
|
17
|
+
s.bindir = "."
|
18
|
+
s.executables = ["fxri"]
|
19
|
+
end
|
20
|
+
|
21
|
+
if __FILE__ == $0
|
22
|
+
Gem.manage_gems
|
23
|
+
Gem::Builder.new(spec).build
|
24
|
+
end
|
data/lib/fxirb.rb
CHANGED
@@ -3,11 +3,10 @@
|
|
3
3
|
# TODO
|
4
4
|
# - handle user input redirection
|
5
5
|
# - readline
|
6
|
-
# - multiline commands
|
7
6
|
|
8
7
|
# Credits:
|
9
8
|
# - Initial linux version: Gilles Filippini
|
10
|
-
# - Initial windows port : Marco
|
9
|
+
# - Initial windows port : Marco Frailis
|
11
10
|
# - Currently maintained and developed by
|
12
11
|
# Martin DeMello <martindemello@gmail.com>
|
13
12
|
|
@@ -22,60 +21,87 @@ STDOUT.sync = true
|
|
22
21
|
|
23
22
|
class FXIRBInputMethod < IRB::StdioInputMethod
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
attr_accessor :print_prompt, :gets_mode
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
super
|
28
|
+
@history = 1
|
28
29
|
@begin = nil
|
30
|
+
@print_prompt = true
|
29
31
|
@end = nil
|
30
|
-
|
32
|
+
@continued_from = nil
|
33
|
+
@gets_mode = false
|
34
|
+
end
|
31
35
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
if @prompt =~ /(\d+)[>*]/
|
36
|
-
print " "*$1.to_i
|
36
|
+
def gets
|
37
|
+
if @gets_mode
|
38
|
+
return FXIrb.instance.get_line
|
37
39
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
if (a = @prompt.match(/(\d+)[>*]/))
|
42
|
+
level = a[1].to_i
|
43
|
+
else
|
44
|
+
level = 0
|
42
45
|
end
|
46
|
+
|
47
|
+
if level > 0
|
48
|
+
@continued_from ||= @line_no
|
49
|
+
elsif @continued_from
|
50
|
+
merge_last(@line_no-@continued_from+1)
|
51
|
+
@continued_from = nil
|
52
|
+
end
|
53
|
+
|
54
|
+
if @print_prompt
|
55
|
+
print @prompt
|
43
56
|
|
57
|
+
#indentation
|
58
|
+
print " "*level
|
59
|
+
end
|
60
|
+
|
61
|
+
str = FXIrb.instance.get_line
|
62
|
+
|
44
63
|
@line_no += 1
|
45
64
|
@history = @line_no + 1
|
46
65
|
@line[@line_no] = str
|
66
|
+
|
67
|
+
str
|
68
|
+
end
|
69
|
+
|
70
|
+
# merge a block spanning several lines into one \n-separated line
|
71
|
+
def merge_last(i)
|
72
|
+
return unless i > 1
|
73
|
+
range = -i..-1
|
74
|
+
@line[range] = @line[range].map {|l| l.chomp}.join("\n")
|
75
|
+
@line_no -= (i-1)
|
76
|
+
@history -= (i-1)
|
47
77
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
return line(@history)
|
70
|
-
end
|
71
|
-
return ""
|
72
|
-
end
|
73
|
-
|
78
|
+
|
79
|
+
def prevCmd
|
80
|
+
return "" if @gets_mode
|
81
|
+
|
82
|
+
if @line_no > 0
|
83
|
+
@history -= 1 unless @history <= 1
|
84
|
+
return line(@history)
|
85
|
+
end
|
86
|
+
return ""
|
87
|
+
end
|
88
|
+
|
89
|
+
def nextCmd
|
90
|
+
return "" if @gets_mode
|
91
|
+
|
92
|
+
if (@line_no > 0) && (@history < @line_no)
|
93
|
+
@history += 1
|
94
|
+
return line(@history)
|
95
|
+
end
|
96
|
+
return ""
|
97
|
+
end
|
98
|
+
|
74
99
|
end
|
75
100
|
|
76
101
|
module IRB
|
77
|
-
|
78
|
-
|
102
|
+
|
103
|
+
def IRB.start_in_fxirb(im)
|
104
|
+
if RUBY_VERSION < "1.7.3"
|
79
105
|
IRB.initialize(nil)
|
80
106
|
IRB.parse_opts
|
81
107
|
IRB.load_modules
|
@@ -93,14 +119,27 @@ module IRB
|
|
93
119
|
trap("SIGINT") do
|
94
120
|
irb.signal_handle
|
95
121
|
end
|
96
|
-
|
97
|
-
|
98
|
-
|
122
|
+
|
123
|
+
class << irb.context.workspace.main
|
124
|
+
def gets
|
125
|
+
inp = IRB.conf[:MAIN_CONTEXT].io
|
126
|
+
inp.gets_mode = true
|
127
|
+
retval = IRB.conf[:MAIN_CONTEXT].io.gets
|
128
|
+
inp.gets_mode = false
|
129
|
+
retval
|
130
|
+
end
|
99
131
|
end
|
100
|
-
|
101
|
-
|
132
|
+
|
133
|
+
catch(:IRB_EXIT) do
|
134
|
+
irb.eval_input
|
135
|
+
end
|
136
|
+
print "\n"
|
137
|
+
|
138
|
+
end
|
139
|
+
|
102
140
|
end
|
103
141
|
|
142
|
+
|
104
143
|
class FXIrb < FXText
|
105
144
|
include Singleton
|
106
145
|
include Responder
|
@@ -129,6 +168,7 @@ class FXIrb < FXText
|
|
129
168
|
|
130
169
|
super
|
131
170
|
setFont(FXFont.new(FXApp.instance, "lucida console", 9))
|
171
|
+
@anchor = 0
|
132
172
|
end
|
133
173
|
|
134
174
|
def create
|
@@ -140,7 +180,7 @@ class FXIrb < FXText
|
|
140
180
|
setFocus
|
141
181
|
setText("")
|
142
182
|
# IRB initialization
|
143
|
-
@inputAdded =
|
183
|
+
@inputAdded = 0
|
144
184
|
@input = IO.pipe
|
145
185
|
$DEFAULT_OUTPUT = self
|
146
186
|
|
@@ -172,16 +212,21 @@ class FXIrb < FXText
|
|
172
212
|
setCursorPos(getLength)
|
173
213
|
super
|
174
214
|
when Fox::KEY_Up,Fox::KEY_KP_Up
|
175
|
-
str = @
|
176
|
-
if str
|
177
|
-
|
178
|
-
|
215
|
+
str = extractText(@anchor, getCursorPos-@anchor)
|
216
|
+
if str =~ /\n/
|
217
|
+
@multiline = true
|
218
|
+
super
|
219
|
+
setCursorPos(@anchor+1) if getCursorPos < @anchor
|
220
|
+
else
|
221
|
+
history(:prev) unless @multiline
|
179
222
|
end
|
180
223
|
when Fox::KEY_Down,Fox::KEY_KP_Down
|
181
|
-
str =
|
182
|
-
if str
|
183
|
-
|
184
|
-
|
224
|
+
str = extractText(getCursorPos, getLength - getCursorPos)
|
225
|
+
if str =~ /\n/
|
226
|
+
@multiline = true
|
227
|
+
super
|
228
|
+
else
|
229
|
+
history(:next) unless @multiline
|
185
230
|
end
|
186
231
|
when Fox::KEY_Left,Fox::KEY_KP_Left
|
187
232
|
if getCursorPos > @anchor
|
@@ -195,16 +240,14 @@ class FXIrb < FXText
|
|
195
240
|
setCursorPos(@anchor)
|
196
241
|
when Fox::KEY_End, Fox::KEY_KP_End
|
197
242
|
setCursorPos(getLength)
|
198
|
-
when Fox::KEY_Page_Up, Fox::KEY_KP_Page_Up
|
199
|
-
|
243
|
+
when Fox::KEY_Page_Up, Fox::KEY_KP_Page_Up
|
244
|
+
history(:prev)
|
245
|
+
when Fox::KEY_Page_Down, Fox::KEY_KP_Page_Down
|
246
|
+
history(:next)
|
200
247
|
when Fox::KEY_bracketright
|
201
248
|
#auto-dedent if the } or ] is on a line by itself
|
202
249
|
if (emptyline? or (getline == "en")) and indented?
|
203
|
-
|
204
|
-
@anchor -= 2
|
205
|
-
rmline
|
206
|
-
appendText(str)
|
207
|
-
setCursorPos(getLength)
|
250
|
+
dedent
|
208
251
|
end
|
209
252
|
super
|
210
253
|
when Fox::KEY_u
|
@@ -292,10 +335,18 @@ class FXIrb < FXText
|
|
292
335
|
end
|
293
336
|
|
294
337
|
def processCommandLine(cmd)
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
338
|
+
@multiline = false
|
339
|
+
lines = cmd.split(/\n/)
|
340
|
+
lines.each {|i|
|
341
|
+
@input[1].puts i
|
342
|
+
@inputAdded += 1
|
343
|
+
}
|
344
|
+
@im.print_prompt = false
|
345
|
+
while (@inputAdded > 0) do
|
346
|
+
@irb.run
|
347
|
+
end
|
348
|
+
@im.merge_last(lines.length)
|
349
|
+
@im.print_prompt = true
|
299
350
|
end
|
300
351
|
|
301
352
|
def sendCommand(cmd)
|
@@ -314,12 +365,12 @@ class FXIrb < FXText
|
|
314
365
|
return str.length
|
315
366
|
end
|
316
367
|
|
317
|
-
def
|
368
|
+
def get_line
|
318
369
|
@anchor = getLength
|
319
|
-
if
|
370
|
+
if @inputAdded == 0
|
320
371
|
Thread.stop
|
321
372
|
end
|
322
|
-
@inputAdded
|
373
|
+
@inputAdded -= 1
|
323
374
|
return @input[0].gets
|
324
375
|
end
|
325
376
|
end
|
@@ -331,7 +382,7 @@ if __FILE__ == $0
|
|
331
382
|
Thread.abort_on_exception = true
|
332
383
|
application.init(ARGV)
|
333
384
|
window = FXMainWindow.new(application, "FXIrb", nil, nil, DECOR_ALL, 0, 0, 580, 500)
|
334
|
-
FXIrb.init(window, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP|TEXT_SHOWACTIVE)
|
385
|
+
fxirb = FXIrb.init(window, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP|TEXT_SHOWACTIVE)
|
335
386
|
application.create
|
336
387
|
window.show(PLACEMENT_SCREEN)
|
337
388
|
application.run
|
metadata
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.
|
2
|
+
rubygems_version: 0.8.6
|
3
3
|
specification_version: 1
|
4
4
|
name: fxri
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
6
|
+
version: 0.2.0
|
7
7
|
date: 2005-02-20
|
8
8
|
summary: "Graphical interface to the RI documentation, with search engine."
|
9
9
|
require_paths:
|
@@ -27,24 +27,24 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
27
27
|
platform: ruby
|
28
28
|
authors: []
|
29
29
|
files:
|
30
|
-
- lib
|
31
30
|
- fxri
|
32
31
|
- fxri.gemspec
|
32
|
+
- lib
|
33
|
+
- lib/Empty_Text_Field_Handler.rb
|
33
34
|
- lib/FoxDisplayer.rb
|
35
|
+
- lib/FoxTextFormatter.rb
|
36
|
+
- lib/fxirb.rb
|
37
|
+
- lib/Globals.rb
|
34
38
|
- lib/icons
|
39
|
+
- lib/Icon_Loader.rb
|
40
|
+
- lib/Packet_Item.rb
|
41
|
+
- lib/Packet_List.rb
|
35
42
|
- lib/Recursive_Open_Struct.rb
|
36
43
|
- lib/RiManager.rb
|
37
|
-
- lib/Globals.rb
|
38
|
-
- lib/fxirb.rb
|
39
|
-
- lib/Packet_Item.rb
|
40
44
|
- lib/Search_Engine.rb
|
41
|
-
- lib/Empty_Text_Field_Handler.rb
|
42
|
-
- lib/FoxTextFormatter.rb
|
43
|
-
- lib/Packet_List.rb
|
44
|
-
- lib/Icon_Loader.rb
|
45
|
-
- lib/icons/module.png
|
46
|
-
- lib/icons/method.png
|
47
45
|
- lib/icons/class.png
|
46
|
+
- lib/icons/method.png
|
47
|
+
- lib/icons/module.png
|
48
48
|
test_files: []
|
49
49
|
rdoc_options: []
|
50
50
|
extra_rdoc_files: []
|