mini_term 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/mini_term/common/mapper.rb +1 -1
- data/lib/mini_term/common/raw_input.rb +11 -3
- data/lib/mini_term/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25b254603c56b9961a9063fe65509530337a9a01
|
4
|
+
data.tar.gz: cb1b30afa508264e0fe728ad740b4f133ca17aff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b304e156337c860b4da1062095b27e49fa4aef1db86dabb3a1db1cae569adb3e725d3a2c567fd5bb6699a0af5b71a208d01bdd92b80f77d1c3439d6f99cef60d
|
7
|
+
data.tar.gz: 90a7c752afd6cd5b2d5937329276c83a5217442ceecbda2b8eaf3af0470707ef2a883f125e68369bfda32a256621a10e520c100febfea1848001a19cc85eaa6c
|
data/README.md
CHANGED
@@ -194,6 +194,9 @@ MiniTerm.raw {|self| } # Execute the block with raw mode active.
|
|
194
194
|
MiniTerm.raw? # Is raw mode active now?
|
195
195
|
```
|
196
196
|
|
197
|
+
Note that raw blocks may be nested to any depth without undesirable
|
198
|
+
side-effects. Infinite recursion is, however, strongly discouraged.
|
199
|
+
|
197
200
|
*MiniTerm.get_raw_char, etc* - These methods deal with the keyboard in a raw
|
198
201
|
mode. They do not echo or wait for the user to press enter or any of those
|
199
202
|
other cooked mode things. Keyboard data in the raw!
|
@@ -3,6 +3,10 @@
|
|
3
3
|
# Get input from the user in raw mode. (Common Code)
|
4
4
|
module MiniTerm
|
5
5
|
|
6
|
+
# Control values for flush.
|
7
|
+
FLUSH_SLEEP = 0.01
|
8
|
+
FLUSH_COUNT = 3
|
9
|
+
|
6
10
|
# Is input raw or cooked?
|
7
11
|
@raw_input = false
|
8
12
|
|
@@ -21,13 +25,17 @@ module MiniTerm
|
|
21
25
|
|
22
26
|
# Flush the keyboard buffer.
|
23
27
|
def self.flush
|
28
|
+
result = ""
|
29
|
+
|
24
30
|
raw do |input|
|
25
|
-
|
26
|
-
|
31
|
+
FLUSH_COUNT.times do
|
32
|
+
sleep(FLUSH_SLEEP)
|
33
|
+
break unless input.has_raw_char?
|
34
|
+
result << input.get_raw_char
|
27
35
|
end
|
28
36
|
end
|
29
37
|
|
30
|
-
|
38
|
+
result
|
31
39
|
end
|
32
40
|
|
33
41
|
end
|
data/lib/mini_term/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_term
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PeterCamilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|