ribhu 0.0.7 → 0.0.8

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.
Files changed (3) hide show
  1. data/bin/ribhu +31 -31
  2. data/ribhu.gemspec +1 -1
  3. metadata +4 -4
data/bin/ribhu CHANGED
@@ -18,26 +18,18 @@
18
18
  #
19
19
  #
20
20
  # TODO:
21
- # allow Alt-m from left list
22
21
  # when pressing enter on left list move focus to right
23
22
  require 'logger'
24
23
  require 'rbcurse'
25
24
  require 'rbcurse/core/widgets/rlist'
26
25
  require 'rbcurse/core/widgets/rtextview'
27
- require 'rbcurse/core/include/vieditable'
26
+ #require 'rbcurse/core/include/vieditable'
28
27
  require 'shellwords'
29
28
  # need recent rbcurse for this 0.0.11 or higher
30
29
  require 'rbcurse/core/widgets/textpad'
31
30
  require 'ribhu'
32
31
 
33
32
 
34
- # why the f are we putting in vieditable here, this is not a demo.
35
- class RubyCurses::List
36
- # vieditable includes listeditable which
37
- # does bring in some functions which can crash program like x and X TODO
38
- # also, f overrides list f mapping. TODO
39
- include ViEditable
40
- end
41
33
  def my_help_text
42
34
  <<-eos
43
35
 
@@ -58,13 +50,17 @@ def my_help_text
58
50
  You may also press Alt-n and Alt-p to cycle through next and previously
59
51
  viewed pages.
60
52
 
61
- Press Alt-C to enter class or method name and see details. If there is
53
+ Press Alt-c to enter class or method name and see details. If there is
62
54
  no data returned, or options returned you may have to select from a list.
63
55
  e.g. entering 'flatten' may return a list of choices to select from.
64
56
  Entering 'Str' returns nothing from ri, so you have to select from classes
65
57
  starting with 'Str'.
66
58
 
67
- Press Alt-D to get a popup of visited classes, from which you may select.
59
+ Press Alt-d to get a popup of visited classes, from which you may select.
60
+
61
+ Press Alt-b to get a popup of bookmarks, from which you may select.
62
+
63
+ Press Alt-m to get a popup of methods for current class, from which you may select.
68
64
 
69
65
  '?' displays all key binding for current object. 'Q' and 'C-q' quit.
70
66
  In any popups, try 'C-q' to quit.
@@ -115,6 +111,11 @@ def display_text word
115
111
  return if lines.nil? || lines.size == 0
116
112
  # ansi can have overflow
117
113
  w.add_content(lines, :content_type => :ansi, :title => word)
114
+
115
+ # Since i am trying without border, so need to put class on top right
116
+ header = @form.by_name["header"];
117
+ header.text_right(word)
118
+
118
119
  $visited << word unless $visited.index(word)
119
120
  #w.add_content(lines, :title => word)
120
121
  w.buffer_last
@@ -273,6 +274,11 @@ if true
273
274
 
274
275
 
275
276
  @window = VER::Window.root_window
277
+ colors = Ncurses.COLORS
278
+ back = :black
279
+ lineback = :blue
280
+ back = 234 if colors >= 256
281
+ lineback = 236 if colors >= 256
276
282
  $window = @window # i need this for get_char, YUCK
277
283
  $catch_alt_digits = true; # emacs like alt-1..9 numeric arguments
278
284
  install_help_text my_help_text
@@ -300,15 +306,17 @@ if true
300
306
  ask_bookmark ch.upcase
301
307
  end
302
308
 
303
- header = app_header "0.0.7", :text_center => "ri Documentation Browser", :text_right =>"" #, :color => :black, :bgcolor => :white #, :attr => :bold
309
+ header = app_header "0.0.8", :text_center => "ri Documentation Browser", :text_right =>"" , :name => "header" , :color => :white, :bgcolor => lineback , :attr => :bold
304
310
 
305
311
 
306
312
 
313
+ #"#[bg=236, fg=black]#[fg=yellow, bold]F1#[/end] Help | #[fg=yellow, bold]?#[/end] Keys | #[fg=yellow, bold]M-c#[/end] Ask | #[fg=yellow, bold]M-d#[/end] History | #[fg=yellow, bold]M-m#[/end] Methods | #[fg=yellow, bold]M-b#[/end] Bookmarks | Q Quit | %20s" % [$message.value]
314
+ _col = "#[fg=yellow]"
307
315
  $message = Variable.new
308
- $message.value = "M-b Bookmarks"
309
- @status_line = status_line :row => Ncurses.LINES-1
316
+ $message.value = ""
317
+ @status_line = status_line :row => Ncurses.LINES-1 #, :bgcolor => :red, :color => :yellow
310
318
  @status_line.command {
311
- "F1 Help | Q Quit | ? Keys | M-c Ask | M-d History | M-m Methods | %20s" % [$message.value]
319
+ "#[bg=236, fg=black]#{_col}F1#[/end] Help | #{_col}?#[/end] Keys | #{_col}M-c#[/end] Ask | #{_col}M-d#[/end] History | #{_col}M-m#[/end] Methods | #{_col}M-b#[/end] Bookmarks | Q Quit | %20s" % [$message.value]
312
320
  }
313
321
 
314
322
  h = FFI::NCurses.LINES-2
@@ -324,12 +332,15 @@ if true
324
332
  :list => mylist,
325
333
  :selection_mode => :SINGLE,
326
334
  :show_selector => true,
335
+ :suppress_borders => true,
336
+ :bgcolor => back,
337
+ :color => :white,
327
338
  :title => " Ruby Classes "
328
339
  #title_attrib 'reverse'
329
340
  listb.one_key_selection = false # this allows us to map keys to methods
330
341
  #listb.vieditable_init_listbox
331
342
  # what for is Io here
332
- include Io
343
+ #include Io
333
344
  listb.bind_key(32) {|l| l.scroll_forward };
334
345
  listb.bind(:PRESS) {
335
346
  ## select class and display riinfo for class
@@ -343,15 +354,13 @@ if true
343
354
  end
344
355
  ## select class and display riinfo for class
345
356
  }
346
- #listb.unbind_key([?', ?'])
347
- #listb.unbind_key(["'","'"])
348
- #listb.unbind_key("'")
357
+ # since keys are added at handle_key, really late, therefore unbind is of no use.
349
358
  listb.bind_key(?', 'select bookmark') do
350
359
  ask_bookmark
351
360
  end
352
361
 
353
362
  tv = RubyCurses::TextView.new @form, :row => r, :col => w+0, :height => h, :width => FFI::NCurses.COLS-w-0,
354
- :name => "tv", :title => "Press Enter on Class"
363
+ :name => "tv", :title => "Press Enter on Class", :suppress_borders => true
355
364
  tv.set_content ["Press Enter on list to view ri information in this area.",
356
365
  "Press ENTER on method name to see details"]
357
366
  require 'rbcurse/core/include/multibuffer'
@@ -367,22 +376,15 @@ if true
367
376
  w = ev.word_under_cursor.strip
368
377
  # check that user did not hit enter on empty area
369
378
  if w != ""
370
- #alert "wuc:#{w}:cp=#{ev.curpos},"
371
- #if w.index("::")
372
- #str=w
373
- #else
374
379
  str = "#{tv.title}.#{w}"
375
380
  _text = try_ri(["#{str}", w])
376
- #end
377
381
  tt = tv.title
378
- #_text = `ri -f rdoc #{str} 2>&1`
379
- #_text = _text.split("\n")
380
382
  if _text.first.index("Nothing known about")
381
- $log.debug "XXXX got #{_text}"
383
+
382
384
  if tt.index("::")
383
385
  ix = tt.index("::")
384
386
  tt = tt[0,ix]
385
- #_text = `ri -f ansi #{tt}::#{w} 2>&1`.gsub('','').split("\n")
387
+
386
388
  _text = get_data "#{tt}::#{w}"
387
389
  end
388
390
  end
@@ -421,8 +423,6 @@ if true
421
423
  meth = Ribhu::ri_full_indexed_list(values, :title => "Methods")
422
424
  if meth
423
425
  meth = meth.strip
424
- #if ix
425
- #meth = values[ix].strip
426
426
  # 2013-03-23 - 00:33 shell escape required for methods like << & [] etc else error
427
427
  # from shell which messes screen.
428
428
  meth = Shellwords.escape(meth)
@@ -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.7"
8
+ spec.version = "0.0.8"
9
9
  spec.authors = ["Rahul Kumar"]
10
10
  spec.email = ["sentinel1879@gmail.com"]
11
11
  spec.description = %q{ri documentation browser using ncurses}
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.7
4
+ version: 0.0.8
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-23 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  segments:
92
92
  - 0
93
- hash: -1717351188235720731
93
+ hash: 4082776761503125510
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  segments:
101
101
  - 0
102
- hash: -1717351188235720731
102
+ hash: 4082776761503125510
103
103
  requirements: []
104
104
  rubyforge_project:
105
105
  rubygems_version: 1.8.25