ruco 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
data/bin/ruco CHANGED
@@ -127,7 +127,6 @@ init_screen do
127
127
  show_app app
128
128
 
129
129
  Keyboard.input do
130
- sleep 0.005 # otherwise its like a loop and uses 100% cpu
131
130
  Curses.getch
132
131
  end
133
132
 
@@ -5,7 +5,7 @@ class Keyboard
5
5
  ENTER = 13
6
6
  ESCAPE = 27
7
7
  IS_18 = RUBY_VERSION =~ /^1\.8/
8
- SEQUENCE_TIMEOUT = 0.02
8
+ SEQUENCE_TIMEOUT = 0.005
9
9
  NOTHING = (2**32 - 1) # getch returns this as 'nothing' on 1.8 but nil on 1.9.2
10
10
  A_TO_Z = ('a'..'z').to_a
11
11
 
@@ -102,7 +102,11 @@ class Keyboard
102
102
  def self.fetch_user_input
103
103
  key = @input.call or return
104
104
  key = key.ord if key.is_a?(String) # ruby 1.9 fix
105
- return if key >= NOTHING
105
+ if key >= NOTHING
106
+ # nothing happening -> sleep a bit to save cpu
107
+ sleep SEQUENCE_TIMEOUT
108
+ return
109
+ end
106
110
  key
107
111
  end
108
112
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruco}
8
- s.version = "0.1.7"
8
+ s.version = "0.1.8"
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-08-04}
12
+ s.date = %q{2011-08-05}
13
13
  s.default_executable = %q{ruco}
14
14
  s.email = %q{michael@grosser.it}
15
15
  s.executables = ["ruco"]
@@ -110,4 +110,10 @@ describe Keyboard do
110
110
  type [27]
111
111
  output.should == [:escape]
112
112
  end
113
- end
113
+
114
+ it "can paste quickly" do
115
+ t = Time.now.to_f
116
+ type Array.new(999).map{ 27 }
117
+ (Time.now.to_f - t).should <= 0.01
118
+ end
119
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
9
+ - 8
10
+ version: 0.1.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-04 00:00:00 +02:00
18
+ date: 2011-08-05 00:00:00 +02:00
19
19
  default_executable: ruco
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency