ruco 0.0.11 → 0.0.12

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
data/lib/ruco.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'ruco/core_ext/object'
2
2
  require 'ruco/core_ext/string'
3
3
  require 'ruco/core_ext/array'
4
+ require 'ruco/core_ext/hash'
4
5
 
5
6
  require 'ruco/cursor'
6
7
 
@@ -42,7 +42,6 @@ module Ruco
42
42
 
43
43
  # modify
44
44
  when :tab then @focused.insert("\t")
45
- when 32..126 then @focused.insert(key.chr) # printable
46
45
  when :enter then
47
46
  @focused.insert("\n")
48
47
  when :backspace then @focused.delete(-1)
@@ -51,6 +50,8 @@ module Ruco
51
50
  when :escape then # escape from focused
52
51
  @focused.reset
53
52
  @focused = editor
53
+ else
54
+ @focused.insert(key)
54
55
  end
55
56
  end
56
57
 
@@ -35,7 +35,7 @@ module Ruco
35
35
  end
36
36
 
37
37
  def reset
38
- @forms_cache[@forms_cache.index(@form)] = nil
38
+ @forms_cache[@forms_cache.key(@form)] = nil
39
39
  @form = nil
40
40
  end
41
41
 
@@ -0,0 +1,4 @@
1
+ class Hash
2
+ # 1.9 does not want index and 1.8 does not have key
3
+ alias_method(:key, :index) unless method_defined?(:key)
4
+ end
data/lib/ruco/keyboard.rb CHANGED
@@ -20,7 +20,6 @@ class Keyboard
20
20
  # modify
21
21
  when 9 then :tab
22
22
  when 13 then :enter # shadows Ctrl+m
23
- when 32..126 then key # printable
24
23
  when 263, 127 then :backspace # ubuntu / mac
25
24
  when Curses::KEY_DC then :delete
26
25
 
@@ -29,7 +28,7 @@ class Keyboard
29
28
  when 1..26 then :"Ctrl+#{A_TO_Z[key-1]}"
30
29
  when 27 then :escape
31
30
  else
32
- key
31
+ key.chr # printable
33
32
  end
34
33
 
35
34
  yield code
data/ruco.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruco}
8
- s.version = "0.0.11"
8
+ s.version = "0.0.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2011-01-14}
12
+ s.date = %q{2011-01-15}
13
13
  s.default_executable = %q{ruco}
14
14
  s.email = %q{michael@grosser.it}
15
15
  s.executables = ["ruco"]
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  "lib/ruco/application.rb",
25
25
  "lib/ruco/command_bar.rb",
26
26
  "lib/ruco/core_ext/array.rb",
27
+ "lib/ruco/core_ext/hash.rb",
27
28
  "lib/ruco/core_ext/object.rb",
28
29
  "lib/ruco/core_ext/string.rb",
29
30
  "lib/ruco/cursor.rb",
@@ -20,10 +20,10 @@ describe Ruco::Application do
20
20
 
21
21
  it "can enter stuff" do
22
22
  write("")
23
- app.key(50)
24
- app.key(50)
23
+ app.key('2')
24
+ app.key('2')
25
25
  app.key(:enter)
26
- app.key(50)
26
+ app.key('2')
27
27
  app.key(:enter)
28
28
  app.view.should == "#{status.sub('.txt ','.txt*')}22\n2\n\n#{command}"
29
29
  end
@@ -31,7 +31,7 @@ describe Ruco::Application do
31
31
  it "can execute a command" do
32
32
  write("123\n456\n789\n")
33
33
  app.key(:"Ctrl+g") # go to line
34
- app.key(50) # 2
34
+ app.key('2') # 2
35
35
  app.key(:enter)
36
36
  app.view.should == "#{status}123\n456\n789\n#{command}"
37
37
  app.cursor.should == [2,0] # 0 offset + 1 for statusbar
@@ -44,7 +44,7 @@ describe Ruco::Application do
44
44
  end
45
45
 
46
46
  it "asks before closing changed file -- escape == no" do
47
- app.key(?a)
47
+ app.key('a')
48
48
  app.key(:"Ctrl+w")
49
49
  app.view.split("\n").last.should include("Loose changes")
50
50
  app.key(:escape).should_not == :quit
@@ -52,7 +52,7 @@ describe Ruco::Application do
52
52
  end
53
53
 
54
54
  it "asks before closing changed file -- enter == yes" do
55
- app.key(?a)
55
+ app.key('a')
56
56
  app.key(:"Ctrl+w")
57
57
  app.view.split("\n").last.should include("Loose changes")
58
58
  app.key(:enter).should == :quit
@@ -62,14 +62,14 @@ describe Ruco::Application do
62
62
  describe 'go to line' do
63
63
  it "goes to the line" do
64
64
  app.key(:"Ctrl+g")
65
- app.key(?2)
65
+ app.key('2')
66
66
  app.key(:enter)
67
67
  app.cursor.should == [2,0] # status bar + 2
68
68
  end
69
69
 
70
70
  it "goes to 1 when strange stuff entered" do
71
71
  app.key(:"Ctrl+g")
72
- app.key(?0)
72
+ app.key('0')
73
73
  app.key(:enter)
74
74
  app.cursor.should == [1,0] # status bar + 1
75
75
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 11
10
- version: 0.0.11
8
+ - 12
9
+ version: 0.0.12
11
10
  platform: ruby
12
11
  authors:
13
12
  - Michael Grosser
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-01-14 00:00:00 +01:00
17
+ date: 2011-01-15 00:00:00 +01:00
19
18
  default_executable: ruco
20
19
  dependencies: []
21
20
 
@@ -38,6 +37,7 @@ files:
38
37
  - lib/ruco/application.rb
39
38
  - lib/ruco/command_bar.rb
40
39
  - lib/ruco/core_ext/array.rb
40
+ - lib/ruco/core_ext/hash.rb
41
41
  - lib/ruco/core_ext/object.rb
42
42
  - lib/ruco/core_ext/string.rb
43
43
  - lib/ruco/cursor.rb
@@ -71,7 +71,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- hash: 3
74
+ hash: -363384083
75
75
  segments:
76
76
  - 0
77
77
  version: "0"
@@ -80,7 +80,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- hash: 3
84
83
  segments:
85
84
  - 0
86
85
  version: "0"