fxri 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: fxri
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.4
6
+ version: 0.3.5
7
7
  date: 2006-12-14 00:00:00 +01:00
8
8
  summary: Graphical interface to the RI documentation, with search engine.
9
9
  require_paths:
@@ -29,31 +29,25 @@ post_install_message:
29
29
  authors: []
30
30
 
31
31
  files:
32
- - bugs
32
+ - lib
33
33
  - fxri
34
- - fxri-0.3.4.gem
35
34
  - fxri.gemspec
36
- - lib
37
- - bugs/fxri bug `concat' can't convert nil into Array (TypeError).eml
38
- - bugs/fxri with Ruby v1.8.5 via OneClickInstaller v1.8.5-21.eml
39
- - lib/Empty_Text_Field_Handler.rb
35
+ - fxri.rb
40
36
  - lib/FoxDisplayer.rb
41
- - lib/FoxTextFormatter.rb
42
- - lib/fxirb-0.2.1
43
- - lib/fxirb.rb
44
- - lib/Globals.rb
45
37
  - lib/icons
46
- - lib/Icon_Loader.rb
47
- - lib/Packet_Item.rb
48
- - lib/Packet_List.rb
49
38
  - lib/Recursive_Open_Struct.rb
50
39
  - lib/RiManager.rb
40
+ - lib/Globals.rb
41
+ - lib/fxirb.rb
42
+ - lib/Packet_Item.rb
51
43
  - lib/Search_Engine.rb
52
- - lib/fxirb-0.2.1/CHANGELOG
53
- - lib/fxirb-0.2.1/fxirb.rb
54
- - lib/icons/class.png
55
- - lib/icons/method.png
44
+ - lib/Empty_Text_Field_Handler.rb
45
+ - lib/FoxTextFormatter.rb
46
+ - lib/Packet_List.rb
47
+ - lib/Icon_Loader.rb
56
48
  - lib/icons/module.png
49
+ - lib/icons/method.png
50
+ - lib/icons/class.png
57
51
  test_files: []
58
52
 
59
53
  rdoc_options: []
@@ -74,8 +68,5 @@ dependencies:
74
68
  requirements:
75
69
  - - ">="
76
70
  - !ruby/object:Gem::Version
77
- version: 1.6.0
78
- - - <
79
- - !ruby/object:Gem::Version
80
- version: "1.7"
71
+ version: 1.2.0
81
72
  version:
@@ -1,50 +0,0 @@
1
- Return-Path: <initcontact@grahamwideman.com>
2
- X-Original-To: markus.prinz@qsig.org
3
- Delivered-To: cypher@qsig.org
4
- Received: from fed1rmmtao07.cox.net (fed1rmmtao07.cox.net [68.230.241.32])
5
- by quaternion.qsig.org (Postfix) with ESMTP id 7313144E58B
6
- for <markus.prinz@qsig.org>; Sat, 2 Sep 2006 12:10:23 +0200 (CEST)
7
- Received: from fed1rmimpo01.cox.net ([70.169.32.71])
8
- by fed1rmmtao07.cox.net
9
- (InterMail vM.6.01.06.01 201-2131-130-101-20060113) with ESMTP
10
- id <20060902101350.JQJJ21457.fed1rmmtao07.cox.net@fed1rmimpo01.cox.net>
11
- for <markus.prinz@qsig.org>; Sat, 2 Sep 2006 06:13:50 -0400
12
- Received: from gw-p4 ([68.7.44.49])
13
- by fed1rmimpo01.cox.net with bizsmtp
14
- id HNDl1V00p13fJ3o0000000
15
- Sat, 02 Sep 2006 06:13:45 -0400
16
- Message-Id: <4.1.20060902031100.003759f8@grahamwideman.com>
17
- X-Sender: (Unverified)
18
- X-Mailer: QUALCOMM Windows Eudora Pro Version 4.1
19
- Date: Sat, 02 Sep 2006 03:14:02 -0700
20
- To: markus.prinz@qsig.org
21
- From: Graham Wideman <initcontact@grahamwideman.com>
22
- Subject: fxri bug: `concat': can't convert nil into Array (TypeError)
23
- Mime-Version: 1.0
24
- Content-Type: text/plain; charset="us-ascii"
25
-
26
- Markus:
27
-
28
- Using fxri included in the current stable ruby 1.8.4 for Windows.
29
-
30
- Upon selecting Class File, fxri disappears, and this remains in the console
31
- window:
32
-
33
- d:/ruby/lib/ruby/1.8/rdoc/ri/ri_descriptions.rb:99:in `concat': can't convert nil into Array (TypeError)
34
- from d:/ruby/lib/ruby/1.8/rdoc/ri/ri_descriptions.rb:99:in `merge_in'
35
- from d:/ruby/lib/ruby/1.8/rdoc/ri/ri_reader.rb:56:in `get_class'
36
- from d:/ruby/lib/ruby/1.8/rdoc/ri/ri_reader.rb:52:in `get_class'
37
- from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./lib/RiManager.rb:102:in `report_class_stuff'
38
- from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./lib/RiManager.rb:96:in `show'
39
- from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./fxri:288:in `on_show'
40
- from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./fxri:296:in `show_info'
41
- from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./fxri:153:in `build'
42
- from d:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.2.6-mswin32/lib/fox12/responder2.rb:57:in `onHandleMsg'
43
- from d:/ruby/lib/ruby/gems/1.8/gems/fxri-0.3.3/./fxri:319
44
- from d:/ruby/bin/fxri.bat:25
45
- -----------------------------------------
46
-
47
- Thanks,
48
-
49
- Graham
50
-
@@ -1,167 +0,0 @@
1
- Return-Path: <smartgpx@gmail.com>
2
- X-Original-To: markus.prinz@qsig.org
3
- Delivered-To: cypher@qsig.org
4
- Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.237])
5
- by quaternion.qsig.org (Postfix) with ESMTP id 1FEAF45A42D
6
- for <markus.prinz@qsig.org>; Fri, 1 Sep 2006 08:23:43 +0200 (CEST)
7
- Received: by wx-out-0506.google.com with SMTP id t5so856535wxc
8
- for <markus.prinz@qsig.org>; Thu, 31 Aug 2006 23:27:09 -0700 (PDT)
9
- DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
10
- s=beta; d=gmail.com;
11
- h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references;
12
- b=o80C5lQCAe4z4RLhucntkvryUG6yHppbdAwf0PHVjzxlcV+yOtqwO7HcS48xO6Ki89yRj6LVJrlrLJZKjVAafyW4hKYiZi81TipiG+xSqEYPlPlZN/gIXkHpp0Cpn1dD+p5AVk0SiDeak+ChL8RyvpgDUcwQLjz7EOW0oTb9ie8=
13
- Received: by 10.90.25.9 with SMTP id 9mr385559agy;
14
- Thu, 31 Aug 2006 23:27:09 -0700 (PDT)
15
- Received: by 10.90.54.15 with HTTP; Thu, 31 Aug 2006 23:27:08 -0700 (PDT)
16
- Message-ID: <533048b70608312327q421f738ct5da10a8d4aba5638@mail.gmail.com>
17
- Date: Fri, 1 Sep 2006 07:27:08 +0100
18
- From: DeeJay <smartgpx@gmail.com>
19
- To: markus.prinz@qsig.org
20
- Subject: Re: fxri with Ruby v1.8.5 via OneClickInstaller v1.8.5-21
21
- In-Reply-To: <44F7272E.6040302@qsig.org>
22
- MIME-Version: 1.0
23
- Content-Type: multipart/alternative;
24
- boundary="----=_Part_55553_6337346.1157092028967"
25
- References: <533048b70608310459t6720f0c1lb13db13155182c85@mail.gmail.com>
26
- <44F6F0E3.30206@qsig.org>
27
- <533048b70608310850q7c8b80e3ub2985380c8d08226@mail.gmail.com>
28
- <44F7272E.6040302@qsig.org>
29
-
30
- ------=_Part_55553_6337346.1157092028967
31
- Content-Type: text/plain; charset=ISO-8859-1; format=flowed
32
- Content-Transfer-Encoding: 7bit
33
- Content-Disposition: inline
34
-
35
- On 31/08/06, Markus Prinz <markus.prinz@qsig.org> wrote:
36
- >
37
- > DeeJay wrote:
38
- > > fire up a 'clean' fxri
39
- > >
40
- > > in the 'search' box, type
41
- > >
42
- > > shdrlhu [deliberately a 'nonsense' word that I would not expect
43
- > to
44
- > > find]
45
- > >
46
- > > and then delete it one character at a time. If you want a genuine search
47
- > > term, try 'scintilla'.
48
- >
49
- > Hm. With the nonsense nothing happened, but when I typed 'scintilla' I
50
- > got the string "Fox::FXRegistry#asciiMode?, Fox::FXRegistry#asciiMode?"
51
- > inserted into the irb pane upon typing the 'i'. Is your output in the
52
- > irb-pane similar?
53
- >
54
- > > Incidentally, while researching this I found that if I tried to search
55
- > for
56
- > > 'array' fxri would die
57
- > > under me on typing the 3rd letter (the second 'r')
58
- > >
59
- > > Hypothesis - if you have 2 adjacent Classes with the first 2 characters
60
- > of
61
- > > their name identical,
62
- > > fxri dies when entering the 3rd char of the Second possibility... but
63
- > not
64
- > > the first.
65
- > >
66
- > > It happens with arr [cf argument], fal [cf fake], and with 'ra', where
67
- > it
68
- > > dies on the 2nd char!
69
- >
70
- > Hm. Nothing happens here when I type it into the search pane, but I'm
71
- > using the OCI 185-21 here. I'll test it with the 184-19 and -20 tomorrow.
72
- >
73
- > > Everything installed via OneClickInstaller 184-19
74
- >
75
- > Would it be possible for you to try installing the OCI 184-20 or 185-21
76
- > and test if the bugs still occur?
77
-
78
-
79
- Retested with OCI 185-21 on WinXP-home SP1. (185-21 [or later] is where
80
- I want to be - I'm not keen on reinstalling earlier versions - I just happen
81
- to have a copy of 184-19 still running, although on XP-proSP2.)
82
-
83
- At 185-21 the 'premature exit during search' problem is not apparent. But
84
- there are still circumstances I have not isolated where fxri dissappears
85
- without warning.
86
-
87
- The 'unexpected input to irb>' problem is still there.
88
-
89
- The following search phrases trigger it -
90
- 'ascii'
91
- 'until'
92
- 'never'
93
- 'shrd'
94
- 'Match'
95
- 'World'
96
-
97
- I note that in each case the string that is injected into irb is the name of
98
- an instance method in Fox::, in which the partial search string appears as a
99
- substring. The name found is injected twice as it is first found, and again
100
- twice as characters are deleted from the search string.
101
-
102
-
103
- One possibility I thought of and have eliminated: I installed OCI185-21 with
104
- RubyGems and Eurokeyboard selected, so I have Windows Envt variables of
105
- RUBYOPT=-rubygems and INPUTRC=...... I have tried removing INPUTRC from the
106
- Envt [set INPUTRC= ] in case this was upsetting the startup of irb, but it
107
- seems to make no difference. Likewise removing RUBYOPT the same way.
108
- (Assuming that doing this SET operation from the Command window that fxri is
109
- started from is the right way to change its Environment?)
110
-
111
- The fact that ri now finds 15,000 entries makes it more noticable that fxri
112
- is very cpu intensive at startup - these tests are on a machine with a
113
- 1.8Ghz cpu which gets saturated for some time while the index is being
114
- populated.
115
-
116
- Regards -
117
-
118
- David
119
- Leicester, UK
120
-
121
- ------=_Part_55553_6337346.1157092028967
122
- Content-Type: text/html; charset=ISO-8859-1
123
- Content-Transfer-Encoding: 7bit
124
- Content-Disposition: inline
125
-
126
- <br><br>
127
- <div><span class="gmail_quote">On 31/08/06, <b class="gmail_sendername">Markus Prinz</b> &lt;<a href="mailto:markus.prinz@qsig.org">markus.prinz@qsig.org</a>&gt; wrote:</span>
128
- <blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">DeeJay wrote:<br>&gt; fire up a 'clean' fxri<br>&gt;<br>&gt; in the 'search' box, type<br>&gt;<br>&gt; shdrlhu&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [deliberately a 'nonsense' word that I would not expect to
129
- <br>&gt; find]<br>&gt;<br>&gt; and then delete it one character at a time. If you want a genuine search<br>&gt; term, try 'scintilla'.<br><br>Hm. With the nonsense nothing happened, but when I typed 'scintilla' I<br>got the string &quot;Fox::FXRegistry#asciiMode?, Fox::FXRegistry#asciiMode?&quot;
130
- <br>inserted into the irb pane upon typing the 'i'. Is your output in the<br>irb-pane similar?<br><br>&gt; Incidentally, while researching this I found that if I tried to search for<br>&gt; 'array' fxri would die<br>&gt; under me on typing the 3rd letter (the second 'r')
131
- <br>&gt;<br>&gt; Hypothesis - if you have 2 adjacent Classes with the first 2 characters of<br>&gt; their name identical,<br>&gt; fxri dies when entering the 3rd char of the Second possibility... but not<br>&gt; the first.
132
- <br>&gt;<br>&gt; It happens with arr [cf argument], fal [cf fake], and with 'ra', where it<br>&gt; dies on the 2nd char!<br><br>Hm. Nothing happens here when I type it into the search pane, but I'm<br>using the OCI 185-21 here. I'll test it with the 184-19 and -20 tomorrow.
133
- <br><br>&gt; Everything installed via OneClickInstaller 184-19<br><br>Would it be possible for you to try installing the OCI 184-20 or 185-21<br>and test if the bugs still occur?</blockquote>
134
- <div>&nbsp;</div>
135
- <div>Retested with OCI 185-21 on WinXP-home SP1. (185-21 [or later] is where</div>
136
- <div>I want to be - I'm not keen on reinstalling earlier versions - I just happen to have a copy of 184-19 still running, although on XP-proSP2.)</div>
137
- <div>&nbsp;</div>
138
- <div>At 185-21 the 'premature exit during search' problem is not apparent. But there are still circumstances I have not isolated where fxri dissappears without warning.</div>
139
- <div>&nbsp;</div>
140
- <div>The 'unexpected input to irb&gt;' problem is still there.</div>
141
- <div>&nbsp;</div>
142
- <div>The following search phrases trigger it -</div>
143
- <div>&nbsp;'ascii'</div>
144
- <div>&nbsp;'until'</div>
145
- <div>&nbsp;'never'</div>
146
- <div>&nbsp;'shrd'</div>
147
- <div>&nbsp;'Match'</div>
148
- <div>&nbsp;'World'</div>
149
- <div>&nbsp;</div>
150
- <div>I note that in each case the string that is injected into irb is the name of an instance method in Fox::, in which the partial search string appears as a substring. The name found is injected twice as it is first found, and again twice as characters are deleted from the search string.
151
- </div>
152
- <div>&nbsp;</div>
153
- <div>&nbsp;</div>
154
- <div>One possibility I thought of and have eliminated: I installed OCI185-21 with RubyGems and Eurokeyboard selected, so I have Windows Envt variables of RUBYOPT=-rubygems and INPUTRC=...... I have tried removing INPUTRC from the Envt [set INPUTRC= ] in case this was upsetting the startup of irb, but it seems to make no difference. Likewise removing RUBYOPT the same way. (Assuming that doing this SET operation from the Command window that fxri is started from is the right way to change its Environment?)
155
- </div>
156
- <div>&nbsp;</div>
157
- <div>The fact that ri now finds 15,000 entries makes it more noticable that fxri is very cpu intensive at startup - these tests are on a machine with a 1.8Ghz cpu which gets saturated for some time while the index is being populated.
158
- </div>
159
- <div>&nbsp;</div>
160
- <div>Regards -</div>
161
- <div>&nbsp;</div>
162
- <div>David</div>
163
- <div>Leicester, UK</div>
164
- <div>&nbsp;</div>
165
- <div>&nbsp;</div><br>&nbsp;</div>
166
-
167
- ------=_Part_55553_6337346.1157092028967--
File without changes
@@ -1,31 +0,0 @@
1
- 0.2.1 - Martin DeMello - 2005/04/13
2
- * 'gets' implemented (with much help from Csaba Henk)
3
-
4
- 0.2.0 - Martin DeMello - 2005/04/10
5
- * Multiline edit
6
- * Settable on_exit proc
7
-
8
- 0.1.4 - Martin DeMello - 2005/02/19
9
- * Minor code cleanup
10
- * Dedentation on ], } or end
11
- * Ctrl-D, Ctrl-U and Ctrl-K keys bound
12
-
13
- 0.1.3 - Martin DeMello - 2004/03/21
14
-
15
- * Added ability to select text, and return the cursor to the proper position
16
- * Changed font to Lucida Console
17
- * Added indentation
18
-
19
- 0.1.2 - Frailis - 2003/01/10
20
-
21
- * Fixed commands history
22
-
23
- 0.1.1 - Frailis - 2003/01/07
24
-
25
- * Removed IOEmulate module because it redirects every "p" operation in a program which embeds FXIrb
26
-
27
- 0.1.0 - Frailis - 2003/01/02
28
-
29
- * Tested on ruby 1.6.7 and 1.7.3
30
- * Added commands history and terminal behaviour
31
-
@@ -1,395 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- # TODO
4
- # - handle user input redirection
5
- # - readline
6
-
7
- # Credits:
8
- # - Initial linux version: Gilles Filippini
9
- # - Initial windows port : Marco Frailis
10
- # - Currently maintained and developed by
11
- # Martin DeMello <martindemello@gmail.com>
12
-
13
- require "fox12"
14
- require "irb"
15
- require "singleton"
16
- require "English"
17
-
18
- include Fox
19
-
20
- STDOUT.sync = true
21
-
22
- class FXIRBInputMethod < IRB::StdioInputMethod
23
-
24
- attr_accessor :print_prompt, :gets_mode
25
-
26
- def initialize
27
- super
28
- @history = 1
29
- @begin = nil
30
- @print_prompt = true
31
- @end = nil
32
- @continued_from = nil
33
- @gets_mode = false
34
- end
35
-
36
- def gets
37
- if @gets_mode
38
- return FXIrb.instance.get_line
39
- end
40
-
41
- if (a = @prompt.match(/(\d+)[>*]/))
42
- level = a[1].to_i
43
- else
44
- level = 0
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
56
-
57
- #indentation
58
- print " "*level
59
- end
60
-
61
- str = FXIrb.instance.get_line
62
-
63
- @line_no += 1
64
- @history = @line_no + 1
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)
77
- end
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
-
99
- end
100
-
101
- module IRB
102
-
103
- def IRB.start_in_fxirb(im)
104
- if RUBY_VERSION < "1.7.3"
105
- IRB.initialize(nil)
106
- IRB.parse_opts
107
- IRB.load_modules
108
- else
109
- IRB.setup(nil)
110
- end
111
-
112
- irb = Irb.new(nil, im)
113
-
114
- @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
115
- @CONF[:MAIN_CONTEXT] = irb.context
116
- trap("SIGINT") do
117
- irb.signal_handle
118
- end
119
-
120
- class << irb.context.workspace.main
121
- def gets
122
- inp = IRB.conf[:MAIN_CONTEXT].io
123
- inp.gets_mode = true
124
- retval = IRB.conf[:MAIN_CONTEXT].io.gets
125
- inp.gets_mode = false
126
- retval
127
- end
128
- end
129
-
130
- catch(:IRB_EXIT) do
131
- irb.eval_input
132
- end
133
- print "\n"
134
-
135
- end
136
-
137
- end
138
-
139
-
140
- class FXIrb < FXText
141
- include Singleton
142
- include Responder
143
-
144
- attr_reader :input
145
-
146
- def FXIrb.init(p, tgt, sel, opts)
147
- unless @__instance__
148
- Thread.critical = true
149
- begin
150
- @__instance__ ||= new(p, tgt, sel, opts)
151
- ensure
152
- Thread.critical = false
153
- end
154
- end
155
- return @__instance__
156
- end
157
-
158
- def initialize(p, tgt, sel, opts)
159
- FXMAPFUNC(SEL_KEYRELEASE, 0, "onKeyRelease")
160
- FXMAPFUNC(SEL_KEYPRESS, 0, "onKeyPress")
161
- FXMAPFUNC(SEL_LEFTBUTTONPRESS,0,"onLeftBtnPress")
162
- FXMAPFUNC(SEL_MIDDLEBUTTONPRESS,0,"onMiddleBtnPress")
163
- FXMAPFUNC(SEL_LEFTBUTTONRELEASE,0,"onLeftBtnRelease")
164
-
165
- super
166
- setFont(FXFont.new(FXApp.instance, "lucida console", 9))
167
- @anchor = 0
168
- end
169
-
170
- def create
171
- super
172
- setFocus
173
- # IRB initialization
174
- @inputAdded = 0
175
- @input = IO.pipe
176
- $DEFAULT_OUTPUT = self
177
-
178
- @im = FXIRBInputMethod.new
179
- @irb = Thread.new {
180
- IRB.start_in_fxirb(@im)
181
- self.crash
182
- }
183
-
184
-
185
- @multiline = false
186
-
187
- @exit_proc = lambda {exit}
188
- end
189
-
190
- def on_exit(&block)
191
- @exit_proc = block
192
- end
193
-
194
- def crash
195
- instance_eval(&@exit_proc)
196
- end
197
-
198
- def onKeyRelease(sender, sel, event)
199
- case event.code
200
- when Fox::KEY_Return, Fox::KEY_KP_Enter
201
- newLineEntered
202
- end
203
- return 1
204
- end
205
-
206
- def onKeyPress(sender,sel,event)
207
- case event.code
208
- when Fox::KEY_Return, Fox::KEY_KP_Enter
209
- setCursorPos(getLength)
210
- super
211
- when Fox::KEY_Up,Fox::KEY_KP_Up
212
- str = extractText(@anchor, getCursorPos-@anchor)
213
- if str =~ /\n/
214
- @multiline = true
215
- super
216
- setCursorPos(@anchor+1) if getCursorPos < @anchor
217
- else
218
- history(:prev) unless @multiline
219
- end
220
- when Fox::KEY_Down,Fox::KEY_KP_Down
221
- str = extractText(getCursorPos, getLength - getCursorPos)
222
- if str =~ /\n/
223
- @multiline = true
224
- super
225
- else
226
- history(:next) unless @multiline
227
- end
228
- when Fox::KEY_Left,Fox::KEY_KP_Left
229
- if getCursorPos > @anchor
230
- super
231
- end
232
- when Fox::KEY_Delete,Fox::KEY_KP_Delete,Fox::KEY_BackSpace
233
- if getCursorPos > @anchor
234
- super
235
- end
236
- when Fox::KEY_Home, Fox::KEY_KP_Home
237
- setCursorPos(@anchor)
238
- when Fox::KEY_End, Fox::KEY_KP_End
239
- setCursorPos(getLength)
240
- when Fox::KEY_Page_Up, Fox::KEY_KP_Page_Up
241
- history(:prev)
242
- when Fox::KEY_Page_Down, Fox::KEY_KP_Page_Down
243
- history(:next)
244
- when Fox::KEY_bracketright
245
- #auto-dedent if the } or ] is on a line by itself
246
- if (emptyline? or (getline == "en")) and indented?
247
- dedent
248
- end
249
- super
250
- when Fox::KEY_u
251
- if (event.state & CONTROLMASK) != 0
252
- str = extractText(getCursorPos, getLength - getCursorPos)
253
- rmline
254
- appendText(str)
255
- setCursorPos(@anchor)
256
- end
257
- super
258
- when Fox::KEY_k
259
- if (event.state & CONTROLMASK) != 0
260
- str = extractText(@anchor, getCursorPos-@anchor)
261
- rmline
262
- appendText(str)
263
- setCursorPos(getLength)
264
- end
265
- super
266
- when Fox::KEY_d
267
- if (event.state & CONTROLMASK) != 0
268
- #Ctrl - D
269
- rmline
270
- appendText("exit")
271
- newLineEntered
272
- else
273
- # test for 'end' so we can dedent
274
- if (getline == "en") and indented?
275
- dedent
276
- end
277
- end
278
- super
279
- else
280
- super
281
- end
282
- end
283
-
284
- def dedent
285
- str = getline
286
- @anchor -= 2
287
- rmline
288
- appendText(str)
289
- setCursorPos(getLength)
290
- end
291
-
292
- def history(dir)
293
- str = (dir == :prev) ? @im.prevCmd.chomp : @im.nextCmd.chomp
294
- if str != ""
295
- removeText(@anchor, getLength-@anchor)
296
- write(str)
297
- end
298
- end
299
-
300
- def getline
301
- extractText(@anchor, getLength-@anchor)
302
- end
303
-
304
- def rmline
305
- str = getline
306
- removeText(@anchor, getLength-@anchor)
307
- str
308
- end
309
-
310
- def emptyline?
311
- getline == ""
312
- end
313
-
314
- def indented?
315
- extractText(@anchor-2, 2) == " "
316
- end
317
-
318
- def onLeftBtnPress(sender,sel,event)
319
- @store_anchor = @anchor
320
- setFocus
321
- super
322
- end
323
-
324
- def onLeftBtnRelease(sender,sel,event)
325
- super
326
- @anchor = @store_anchor
327
- setCursorPos(@anchor)
328
- setCursorPos(getLength)
329
- end
330
-
331
- def onMiddleBtnPress(sender,sel,event)
332
- pos=getPosAt(event.win_x,event.win_y)
333
- if pos >= @anchor
334
- super
335
- end
336
- end
337
-
338
- def newLineEntered
339
- processCommandLine(extractText(@anchor, getLength-@anchor))
340
- end
341
-
342
- def processCommandLine(cmd)
343
- @multiline = false
344
- lines = cmd.split(/\n/)
345
- lines.each {|i|
346
- @input[1].puts i
347
- @inputAdded += 1
348
- }
349
- @im.print_prompt = false
350
- while (@inputAdded > 0) do
351
- @irb.run
352
- end
353
- @im.merge_last(lines.length)
354
- @im.print_prompt = true
355
- end
356
-
357
- def sendCommand(cmd)
358
- setCursorPos(getLength)
359
- makePositionVisible(getLength) unless isPosVisible(getLength)
360
- cmd += "\n"
361
- appendText(cmd)
362
- processCommandLine(cmd)
363
- end
364
-
365
- def write(obj)
366
- str = obj.to_s
367
- appendText(str)
368
- setCursorPos(getLength)
369
- makePositionVisible(getLength) unless isPosVisible(getLength)
370
- return str.length
371
- end
372
-
373
- def get_line
374
- @anchor = getLength
375
- if @inputAdded == 0
376
- Thread.stop
377
- end
378
- @inputAdded -= 1
379
- return @input[0].gets
380
- end
381
- end
382
-
383
- # Stand alone run
384
- if __FILE__ == $0
385
- application = FXApp.new("FXIrb", "ruby")
386
- application.threadsEnabled = true
387
- Thread.abort_on_exception = true
388
- application.init(ARGV)
389
- window = FXMainWindow.new(application, "FXIrb", nil, nil, DECOR_ALL, 0, 0, 580, 500)
390
- fxirb = FXIrb.init(window, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP|TEXT_SHOWACTIVE)
391
- application.create
392
- window.show(PLACEMENT_SCREEN)
393
- fxirb.on_exit {exit}
394
- application.run
395
- end