interact 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.size == 1
328
- ans = state.answer = matches[0].dup
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") # bell
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)
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2011 Alex Suraci
2
2
 
3
3
  module Interact
4
- VERSION = "0.4.4"
4
+ VERSION = "0.4.5"
5
5
  end
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: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.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-14 00:00:00 Z
18
+ date: 2012-07-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake