interact 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/interact/interactive.rb +8 -6
- data/lib/interact/version.rb +1 -1
- metadata +4 -4
data/lib/interact/interactive.rb
CHANGED
@@ -290,6 +290,8 @@ module Interactive
|
|
290
290
|
end
|
291
291
|
|
292
292
|
def common_prefix(*strs)
|
293
|
+
return strs.first.dup if strs.size == 1
|
294
|
+
|
293
295
|
longest = strs.sort_by(&:size).last
|
294
296
|
longest.size.times do |i|
|
295
297
|
sub = longest[0..(-1 - i)]
|
@@ -324,13 +326,13 @@ module Interactive
|
|
324
326
|
matching_paths(ans)
|
325
327
|
end
|
326
328
|
|
327
|
-
if matches.
|
328
|
-
|
329
|
-
state.display(ans[pos .. -1])
|
329
|
+
if matches.empty?
|
330
|
+
print("\a") # bell
|
330
331
|
else
|
332
|
+
old = ans
|
331
333
|
ans = state.answer = common_prefix(*matches)
|
332
334
|
state.display(ans[pos .. -1])
|
333
|
-
print("\a")
|
335
|
+
print("\a") if ans == old
|
334
336
|
end
|
335
337
|
|
336
338
|
when :right
|
@@ -549,13 +551,13 @@ module Interactive
|
|
549
551
|
|
550
552
|
before = `stty -g`
|
551
553
|
|
552
|
-
system("stty -echo -icanon isig")
|
554
|
+
Kernel.system("stty -echo -icanon isig")
|
553
555
|
|
554
556
|
before
|
555
557
|
end
|
556
558
|
|
557
559
|
def restore_input_state(input, before)
|
558
|
-
system("stty #{before}") if before
|
560
|
+
Kernel.system("stty #{before}") if before
|
559
561
|
end
|
560
562
|
|
561
563
|
def get_character(input)
|
data/lib/interact/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 5
|
10
|
+
version: 0.4.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Suraci
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-07-
|
18
|
+
date: 2012-07-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|