ribhu 0.0.6 → 0.0.7
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/README.md +2 -1
- data/bin/ribhu +58 -27
- data/ribhu.gemspec +2 -2
- metadata +7 -6
data/README.md
CHANGED
@@ -30,7 +30,8 @@ between previous and next pages viewed.
|
|
30
30
|
Please get back to me if there are cases where it's unhelpful in finding the ridocs.
|
31
31
|
|
32
32
|
2013-03-21 - 19:10 : Fixed bug: display of Instance methods on Alt-m had stopped working after
|
33
|
-
changing format to ANSI.
|
33
|
+
changing format to ANSI. You may now press Alt-m even when you are on a method since we requery
|
34
|
+
methods based on class-name and do not look up page content
|
34
35
|
|
35
36
|
## Installation
|
36
37
|
|
data/bin/ribhu
CHANGED
@@ -17,16 +17,21 @@
|
|
17
17
|
# as manages keys. It also takes care of logger and includes major stuff.
|
18
18
|
#
|
19
19
|
#
|
20
|
-
# TODO:
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# and not RubyC::Link.Button -- keep trying options till we get something
|
20
|
+
# TODO:
|
21
|
+
# allow Alt-m from left list
|
22
|
+
# when pressing enter on left list move focus to right
|
24
23
|
require 'logger'
|
25
24
|
require 'rbcurse'
|
26
25
|
require 'rbcurse/core/widgets/rlist'
|
27
26
|
require 'rbcurse/core/widgets/rtextview'
|
28
27
|
require 'rbcurse/core/include/vieditable'
|
28
|
+
require 'shellwords'
|
29
|
+
# need recent rbcurse for this 0.0.11 or higher
|
30
|
+
require 'rbcurse/core/widgets/textpad'
|
31
|
+
require 'ribhu'
|
29
32
|
|
33
|
+
|
34
|
+
# why the f are we putting in vieditable here, this is not a demo.
|
30
35
|
class RubyCurses::List
|
31
36
|
# vieditable includes listeditable which
|
32
37
|
# does bring in some functions which can crash program like x and X TODO
|
@@ -179,9 +184,11 @@ def set_focus_on str
|
|
179
184
|
end
|
180
185
|
|
181
186
|
## user has pressed bokmark char, now get the mark A-Z
|
182
|
-
def ask_bookmark
|
183
|
-
ch
|
184
|
-
|
187
|
+
def ask_bookmark ch=nil
|
188
|
+
unless ch
|
189
|
+
ch = @window.getchar
|
190
|
+
ch = ch.chr.upcase
|
191
|
+
end
|
185
192
|
str = $bookmarks[ch.to_sym]
|
186
193
|
if str
|
187
194
|
display_text str
|
@@ -242,7 +249,8 @@ if true
|
|
242
249
|
begin
|
243
250
|
# Initialize curses
|
244
251
|
VER::start_ncurses # this is initializing colors via ColorMap.setup
|
245
|
-
|
252
|
+
path = File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")
|
253
|
+
logfilename = File.open(path, File::WRONLY|File::TRUNC|File::CREAT)
|
246
254
|
$log = Logger.new(logfilename)
|
247
255
|
$log.level = Logger::DEBUG
|
248
256
|
|
@@ -265,6 +273,7 @@ if true
|
|
265
273
|
|
266
274
|
|
267
275
|
@window = VER::Window.root_window
|
276
|
+
$window = @window # i need this for get_char, YUCK
|
268
277
|
$catch_alt_digits = true; # emacs like alt-1..9 numeric arguments
|
269
278
|
install_help_text my_help_text
|
270
279
|
# Initialize few color pairs
|
@@ -283,29 +292,33 @@ if true
|
|
283
292
|
@form.bind_key(?\M-d, 'View history') do
|
284
293
|
popup_history
|
285
294
|
end
|
295
|
+
@form.bind_key(?\M-b, 'View bookmarks') do
|
296
|
+
# Display bookmarks and allow user to select one
|
297
|
+
list = []
|
298
|
+
$bookmarks.each_pair { |k, v| list << " #[fg=yellow, bold] #{k} #[/end] #[fg=cyan] #{v} #[/end]" }
|
299
|
+
ch = padpopup list, :title => "View Bookmarks"
|
300
|
+
ask_bookmark ch.upcase
|
301
|
+
end
|
302
|
+
|
303
|
+
header = app_header "0.0.7", :text_center => "ri Documentation Browser", :text_right =>"" #, :color => :black, :bgcolor => :white #, :attr => :bold
|
286
304
|
|
287
|
-
header = app_header "0.0.5", :text_center => "ri Documentation Browser", :text_right =>"" #, :color => :black, :bgcolor => :white #, :attr => :bold
|
288
|
-
# this is the old style of printing something directly on the window.
|
289
|
-
# The new style is to use a header
|
290
|
-
#@form.window.printstring 0, 30, "ri documentation browser", $normalcolor, BOLD
|
291
|
-
r = 1; fc = 1;
|
292
305
|
|
293
|
-
# this is the old style of using a label at the screen bottom, you can use the status_line
|
294
306
|
|
295
307
|
$message = Variable.new
|
296
|
-
$message.value = "
|
308
|
+
$message.value = "M-b Bookmarks"
|
297
309
|
@status_line = status_line :row => Ncurses.LINES-1
|
298
310
|
@status_line.command {
|
299
|
-
"F1 Help | Q Quit | ? Keys | M-c
|
311
|
+
"F1 Help | Q Quit | ? Keys | M-c Ask | M-d History | M-m Methods | %20s" % [$message.value]
|
300
312
|
}
|
301
313
|
|
302
314
|
h = FFI::NCurses.LINES-2
|
303
315
|
mylist = `ri -l `.split("\n")
|
304
316
|
w = 25
|
317
|
+
r = 1
|
305
318
|
|
306
319
|
listb = List.new @form, :name => "mylist" ,
|
307
320
|
:row => r ,
|
308
|
-
:col =>
|
321
|
+
:col => 0 ,
|
309
322
|
:width => w,
|
310
323
|
:height => h,
|
311
324
|
:list => mylist,
|
@@ -319,8 +332,8 @@ if true
|
|
319
332
|
include Io
|
320
333
|
listb.bind_key(32) {|l| l.scroll_forward };
|
321
334
|
listb.bind(:PRESS) {
|
322
|
-
display_text listb.text
|
323
335
|
## select class and display riinfo for class
|
336
|
+
display_text listb.text
|
324
337
|
}
|
325
338
|
listb.bind_key(?m) {
|
326
339
|
str = listb.text
|
@@ -337,7 +350,7 @@ if true
|
|
337
350
|
ask_bookmark
|
338
351
|
end
|
339
352
|
|
340
|
-
tv = RubyCurses::TextView.new @form, :row => r, :col => w+
|
353
|
+
tv = RubyCurses::TextView.new @form, :row => r, :col => w+0, :height => h, :width => FFI::NCurses.COLS-w-0,
|
341
354
|
:name => "tv", :title => "Press Enter on Class"
|
342
355
|
tv.set_content ["Press Enter on list to view ri information in this area.",
|
343
356
|
"Press ENTER on method name to see details"]
|
@@ -379,22 +392,40 @@ if true
|
|
379
392
|
end
|
380
393
|
end
|
381
394
|
}
|
382
|
-
|
395
|
+
@form.bind_key(?\M-m, "Select methods") {
|
396
|
+
tv = @form.by_name["tv"];
|
383
397
|
kl = tv.title.strip
|
384
|
-
|
398
|
+
if kl.index "."
|
399
|
+
kl = kl.split(".")[0]
|
400
|
+
end
|
401
|
+
|
402
|
+
# 2013-03-21 - 19:50 since the display may be of a selected method
|
403
|
+
# so we requery the methods each time. Can we go to old position somehow ?
|
404
|
+
lines = `ri -f rdoc #{kl} 2>&1`.split("\n")
|
385
405
|
# 2013-03-21 - 19:09 Fixed, had stopped working after change to ansi format
|
386
|
-
ix = lines.grep(/Instance methods:/)
|
387
|
-
ix = lines.index(
|
406
|
+
#ix = lines.grep(/Instance methods:/)
|
407
|
+
ix = lines.index("= Instance methods:")
|
388
408
|
unless ix
|
389
|
-
alert "No instance methods found #{
|
409
|
+
alert "No instance methods found for #{kl}"
|
390
410
|
end
|
391
411
|
if ix
|
392
412
|
values = lines[ix+2..-1]
|
393
413
|
values = values.collect { |x| x.strip }
|
394
414
|
#ix = popuplist(values)
|
395
|
-
ix = popuplist(values, :title => " Methods ", :bgcolor => :blue, :color => :white)
|
396
|
-
|
397
|
-
|
415
|
+
#ix = popuplist(values, :title => " Methods ", :bgcolor => :blue, :color => :white)
|
416
|
+
# the problem is when the list is longer than indexing values
|
417
|
+
# since we are not doing pagin in this small popup.
|
418
|
+
#
|
419
|
+
# maybe whenever we scroll or page, redo the numbering from a, and keep sta
|
420
|
+
#meth = Ribhu::indexed_list("Methods", values)
|
421
|
+
meth = Ribhu::ri_full_indexed_list(values, :title => "Methods")
|
422
|
+
if meth
|
423
|
+
meth = meth.strip
|
424
|
+
#if ix
|
425
|
+
#meth = values[ix].strip
|
426
|
+
# 2013-03-23 - 00:33 shell escape required for methods like << & [] etc else error
|
427
|
+
# from shell which messes screen.
|
428
|
+
meth = Shellwords.escape(meth)
|
398
429
|
display_text "#{kl}.#{meth}"
|
399
430
|
end
|
400
431
|
end
|
data/ribhu.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "ribhu"
|
8
|
-
spec.version = "0.0.
|
8
|
+
spec.version = "0.0.7"
|
9
9
|
spec.authors = ["Rahul Kumar"]
|
10
10
|
spec.email = ["sentinel1879@gmail.com"]
|
11
11
|
spec.description = %q{ri documentation browser using ncurses}
|
@@ -20,5 +20,5 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
-
spec.add_dependency "rbcurse-core"
|
23
|
+
spec.add_dependency "rbcurse-core", ">= 0.0.11"
|
24
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ribhu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
53
|
+
version: 0.0.11
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.0.11
|
62
62
|
description: ri documentation browser using ncurses
|
63
63
|
email:
|
64
64
|
- sentinel1879@gmail.com
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- README.md
|
74
74
|
- Rakefile
|
75
75
|
- bin/ribhu
|
76
|
+
- lib/ribhu.rb
|
76
77
|
- ribhu.gemspec
|
77
78
|
homepage: https://github.com/rkumar/ribhu
|
78
79
|
licenses:
|
@@ -89,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
90
|
version: '0'
|
90
91
|
segments:
|
91
92
|
- 0
|
92
|
-
hash:
|
93
|
+
hash: -1717351188235720731
|
93
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
95
|
none: false
|
95
96
|
requirements:
|
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
99
|
version: '0'
|
99
100
|
segments:
|
100
101
|
- 0
|
101
|
-
hash:
|
102
|
+
hash: -1717351188235720731
|
102
103
|
requirements: []
|
103
104
|
rubyforge_project:
|
104
105
|
rubygems_version: 1.8.25
|