djinni 2.2.2 → 2.2.3

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/djinni.rb +15 -10
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c386d8b47f5eec2592bcc5342db3473670ac7352ee054e80a03902c44441f07
4
- data.tar.gz: 5ec0cdfbac77e7cfdb4511910fb85c068ede75cd8e89138887406a2d7b8c11bc
3
+ metadata.gz: 1fcd7ceeb81b894886dcca48088eea5012cef7a750f3df0ffe39beb1baf012aa
4
+ data.tar.gz: d3d8ea9414e871314a41d1d2fd3ee07ee6d5433d188eac3caf55b699a44f6bd8
5
5
  SHA512:
6
- metadata.gz: a32b22a30c61c183d45ab8bdb435205d15d6c41c0e7dc841a26738f7ba138c608f7fa45559175f11bc5a361611d5f272a6dcaafa1c81f6c133a7c19c67963535
7
- data.tar.gz: d641057292ca3cfdc16275bec110f4990c1d1cd0be995e016b7104ac489803138c8f9dc5199caff8f730247f7a02742dc813ca41bbba0c7b5d0f4d3b4883cb1e
6
+ metadata.gz: b6f740be301aebd532a4799db0ff56e2fc1527e7d77c1b02310153ac45a5b1585dabbfb574d9e095861bfe8cc1c7a8a7fb47a69a231f6a0e008f1fc7d2b49bef
7
+ data.tar.gz: 2078235c6392ea62d2b2011a6689f3960dcff358977b60d848c1224dcdafa22a88a344e38d6382a695e733b529130c051e0d59534cc3495009e1bb89565ed2aa
data/lib/djinni.rb CHANGED
@@ -10,6 +10,7 @@ class Djinni
10
10
  djinni_env["djinni"] = self
11
11
  djinni_env["djinni_history"] = @history
12
12
  djinni_env["djinni_wishes"] = @wishes
13
+ space = 4
13
14
 
14
15
  case input[-1]
15
16
  when "\x03" # ^C
@@ -55,15 +56,17 @@ class Djinni
55
56
  )
56
57
  end
57
58
 
58
- puts
59
59
  max = completions.keys.max_by(&:length).length
60
+ width = @width - (max + space) - 2
61
+
62
+ puts
60
63
  completions.each do |item, desc|
61
- fill = Array.new(max + 4 - item.length, " ").join
62
- nlfill = Array.new(max + 4, " ").join
64
+ fill = " " * (max + space - item.length)
63
65
  lines = ""
66
+ nlfill = " " * (max + space)
64
67
  if (desc)
65
68
  lines = desc.scan(
66
- /\S.{0,#{80 - (max + 4)}}\S(?=\s|$)|\S+/
69
+ /\S.{0,#{width}}\S(?=\s|$)|\S+/
67
70
  )
68
71
  end
69
72
 
@@ -93,16 +96,18 @@ class Djinni
93
96
  return "#{wishes.first.first} "
94
97
  end
95
98
 
96
- puts
97
99
  max = wishes.keys.max_by(&:length).length
100
+ width = @width - (max + space) - 2
101
+
102
+ puts
98
103
  wishes.sort do |a, b|
99
104
  a.first.downcase <=> b.first.downcase
100
105
  end.each do |aliaz, w|
101
- fill = Array.new(max + 4 - aliaz.length, " ").join
102
- nlfill = Array.new(max + 4, " ").join
106
+ fill = " " * (max + space - aliaz.length)
103
107
  lines = w.description.scan(
104
- /\S.{0,#{80 - (max + 4)}}\S(?=\s|$)|\S+/
108
+ /\S.{0,#{width}}\S(?=\s|$)|\S+/
105
109
  )
110
+ nlfill = " " * (max + space)
106
111
 
107
112
  if (lines.empty?)
108
113
  puts "#{aliaz}"
@@ -198,7 +203,7 @@ class Djinni
198
203
  @wishes = Hash.new
199
204
 
200
205
  Signal.trap(
201
- "SIGWINCH",
206
+ "WINCH",
202
207
  proc do
203
208
  @width = %x(tput cols).to_i
204
209
  end
@@ -243,7 +248,7 @@ class Djinni
243
248
  buff = ""
244
249
  loop do
245
250
  djinni_prompt = djinni_env["djinni_prompt"]
246
- blank_line = Array.new(@width, " ").join
251
+ blank_line = " " * @width
247
252
 
248
253
  # Handle long lines that get wrapped
249
254
  buff_len = remove_colors(djinni_prompt).length + prev_len
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: djinni
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-12 00:00:00.000000000 Z
11
+ date: 2018-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest