rbcurse-core 0.0.5 → 0.0.6
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/NOTES +2151 -0
 - data/VERSION +1 -1
 - data/lib/rbcurse/core/include/chunk.rb +13 -1
 - data/lib/rbcurse/core/util/rdialogs.rb +14 -2
 - data/rbcurse-core.gemspec +3 -2
 - metadata +3 -2
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.0.6
         
     | 
| 
         @@ -4,7 +4,7 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
            #       Author: rkumar http://github.com/rkumar/rbcurse/
         
     | 
| 
       5 
5 
     | 
    
         
             
            #         Date: 07.11.11 - 12:31 
         
     | 
| 
       6 
6 
     | 
    
         
             
            #  Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
         
     | 
| 
       7 
     | 
    
         
            -
            #  Last update:  
     | 
| 
      
 7 
     | 
    
         
            +
            #  Last update: 2013-03-08 00:03
         
     | 
| 
       8 
8 
     | 
    
         
             
            # ------------------------------------------------------------ #
         
     | 
| 
       9 
9 
     | 
    
         
             
            #
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
         @@ -60,11 +60,23 @@ module Chunks 
     | 
|
| 
       60 
60 
     | 
    
         
             
                  @chunks.each { |e| result += e.text.length }
         
     | 
| 
       61 
61 
     | 
    
         
             
                  return result
         
     | 
| 
       62 
62 
     | 
    
         
             
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
                # returns match for str in this chunk
         
     | 
| 
      
 64 
     | 
    
         
            +
                # added 2013-03-07 - 23:59 
         
     | 
| 
      
 65 
     | 
    
         
            +
                def index str
         
     | 
| 
      
 66 
     | 
    
         
            +
                  result = 0
         
     | 
| 
      
 67 
     | 
    
         
            +
                  @chunks.each { |e| txt = e.text; 
         
     | 
| 
      
 68 
     | 
    
         
            +
                    ix =  txt.index(str) 
         
     | 
| 
      
 69 
     | 
    
         
            +
                    return result + ix if ix
         
     | 
| 
      
 70 
     | 
    
         
            +
                    result += e.text.length 
         
     | 
| 
      
 71 
     | 
    
         
            +
                  }
         
     | 
| 
      
 72 
     | 
    
         
            +
                  return nil
         
     | 
| 
      
 73 
     | 
    
         
            +
                end
         
     | 
| 
       63 
74 
     | 
    
         
             
                alias :length :row_length
         
     | 
| 
       64 
75 
     | 
    
         
             
                alias :size   :row_length
         
     | 
| 
       65 
76 
     | 
    
         | 
| 
       66 
77 
     | 
    
         
             
                # return a Chunkline containing only the text for the range requested
         
     | 
| 
       67 
78 
     | 
    
         
             
                def substring start, size
         
     | 
| 
      
 79 
     | 
    
         
            +
                  raise "substring not implemented yet"
         
     | 
| 
       68 
80 
     | 
    
         
             
                end
         
     | 
| 
       69 
81 
     | 
    
         
             
                def to_s
         
     | 
| 
       70 
82 
     | 
    
         
             
                  result = ""
         
     | 
| 
         @@ -86,19 +86,31 @@ def get_string label, config={} # yield Field 
     | 
|
| 
       86 
86 
     | 
    
         
             
              defwid = config[:default].nil? ? 30 : config[:default].size + 13
         
     | 
| 
       87 
87 
     | 
    
         
             
              w = [label.size + 8, defwid, field_config[:width]+13 ].max
         
     | 
| 
       88 
88 
     | 
    
         
             
              config[:width] ||= w
         
     | 
| 
      
 89 
     | 
    
         
            +
              ## added history 2013-03-06 - 14:25 : we could keep history based on prompt
         
     | 
| 
      
 90 
     | 
    
         
            +
              $get_string_history ||= []
         
     | 
| 
       89 
91 
     | 
    
         
             
              #$log.debug "XXX:  FIELD SIZE #{w} "
         
     | 
| 
       90 
92 
     | 
    
         
             
              #$log.debug "XXX:  FIELD CONFIG #{field_config} "
         
     | 
| 
       91 
93 
     | 
    
         
             
              tp = MessageBox.new config do
         
     | 
| 
       92 
94 
     | 
    
         
             
                button_type :ok_cancel
         
     | 
| 
       93 
95 
     | 
    
         
             
                default_button 0
         
     | 
| 
       94 
96 
     | 
    
         
             
                item Label.new nil, label_config
         
     | 
| 
       95 
     | 
    
         
            -
                 
     | 
| 
      
 97 
     | 
    
         
            +
                fld = Field.new nil, field_config
         
     | 
| 
      
 98 
     | 
    
         
            +
                item fld
         
     | 
| 
      
 99 
     | 
    
         
            +
                ## added field history 2013-03-06 - 14:24 
         
     | 
| 
      
 100 
     | 
    
         
            +
                    require 'rbcurse/core/include/rhistory'
         
     | 
| 
      
 101 
     | 
    
         
            +
                    fld.extend(FieldHistory)
         
     | 
| 
      
 102 
     | 
    
         
            +
                    # We need to manually set history each time, since the field is recreated
         
     | 
| 
      
 103 
     | 
    
         
            +
                    # with the messagebox. Otherwise, field can on its own handle history
         
     | 
| 
      
 104 
     | 
    
         
            +
                    fld.history($get_string_history)
         
     | 
| 
       96 
105 
     | 
    
         
             
              end
         
     | 
| 
       97 
106 
     | 
    
         
             
              # added yield to override settings
         
     | 
| 
       98 
107 
     | 
    
         
             
              yield tp.form.by_name[:name] if block_given?
         
     | 
| 
       99 
108 
     | 
    
         
             
              index = tp.run
         
     | 
| 
       100 
109 
     | 
    
         
             
              if index == 0 # OK
         
     | 
| 
       101 
     | 
    
         
            -
                 
     | 
| 
      
 110 
     | 
    
         
            +
                ## added field history 2013-03-06 - 14:24 
         
     | 
| 
      
 111 
     | 
    
         
            +
                t = tp.form.by_name[:name].text
         
     | 
| 
      
 112 
     | 
    
         
            +
                $get_string_history << t if t && !$get_string_history.include?(t)
         
     | 
| 
      
 113 
     | 
    
         
            +
                return t
         
     | 
| 
       102 
114 
     | 
    
         
             
              else # CANCEL
         
     | 
| 
       103 
115 
     | 
    
         
             
                # Should i use nil or blank. I am currently opting for nil, as this may imply to caller
         
     | 
| 
       104 
116 
     | 
    
         
             
                # that user does not wish to override whatever value is being prompted for.
         
     | 
    
        data/rbcurse-core.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = "rbcurse-core"
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0.0. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.0.6"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Rahul Kumar"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = "2013-03- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = "2013-03-08"
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = "Ruby curses/ncurses widgets for easy application development on text terminals (ruby 1.9, 1.8)"
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = "sentinel1879@gmail.com"
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
| 
         @@ -17,6 +17,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       17 
17 
     | 
    
         
             
              ]
         
     | 
| 
       18 
18 
     | 
    
         
             
              s.files = [
         
     | 
| 
       19 
19 
     | 
    
         
             
                "CHANGELOG",
         
     | 
| 
      
 20 
     | 
    
         
            +
                "NOTES",
         
     | 
| 
       20 
21 
     | 
    
         
             
                "README.md",
         
     | 
| 
       21 
22 
     | 
    
         
             
                "VERSION",
         
     | 
| 
       22 
23 
     | 
    
         
             
                "examples/abasiclist.rb",
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rbcurse-core
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.6
         
     | 
| 
       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-08 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: ffi-ncurses
         
     | 
| 
         @@ -36,6 +36,7 @@ extra_rdoc_files: 
     | 
|
| 
       36 
36 
     | 
    
         
             
            - README.md
         
     | 
| 
       37 
37 
     | 
    
         
             
            files:
         
     | 
| 
       38 
38 
     | 
    
         
             
            - CHANGELOG
         
     | 
| 
      
 39 
     | 
    
         
            +
            - NOTES
         
     | 
| 
       39 
40 
     | 
    
         
             
            - README.md
         
     | 
| 
       40 
41 
     | 
    
         
             
            - VERSION
         
     | 
| 
       41 
42 
     | 
    
         
             
            - examples/abasiclist.rb
         
     |