ansi-select 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93196545ca121d05b923862104bdc6fda3754099
4
- data.tar.gz: 8e80b117b41c20fe78890a53cf398f8eb8fe568f
3
+ metadata.gz: 1378e23b4792a1b8e537ceb3a258bf114cb8e018
4
+ data.tar.gz: 643ed6980728846d7b0482ad4c0d5e5c414b90ad
5
5
  SHA512:
6
- metadata.gz: ba1b17043fde1207bb846516415a9f4305eee48959f960633d2f17cdbcf842b52208e30ddd87c18565274d28cdcc3815878bf1b869911087d3fdae34b06859aa
7
- data.tar.gz: 4ae6c420d9aefca3f59c626100922d849436482cd5c5a68da207e3395399962788cf37f1ce679cd5d702b928f45827681cf28c4d98eef2a0f71c2ba8de966d0f
6
+ metadata.gz: e0d1de90043ec51fb3cf564c5fd13cf969a674ce4ecfd7ecd01ceac12abee05a3f7197b91e39ff4a1424b1c42c001fa8dd102220b0595d539cce95ecbe8a6d0e
7
+ data.tar.gz: 4d089f8d2ebe34c45c47466c2804c73532446e014c3ec9f12b35242228679525a3efc05694e7dbb690b13d674981067364a28289e5bf614ea79d137af378f5bf
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ### 0.3.2
2
+
3
+ * Fix the issue when the path to `position.sh` was incorrect if run as a library.
4
+
1
5
  ### 0.3.1
2
6
 
3
- * Navigate using Ctrl+N and Ctrl+P
7
+ * Navigate using `Ctrl+N` and `Ctrl+P`.
4
8
  * Add the `--version` options.
5
9
 
6
10
  ### 0.3.0
@@ -3,6 +3,8 @@ require "io/console"
3
3
  module Ansi
4
4
  class Selector
5
5
  class Impl
6
+ POSITION_SCRIPT_PATH = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "position.sh"))
7
+
6
8
  CODES = {
7
9
  standout_mode: `tput rev`,
8
10
  exit_standout_mode: `tput rmso`,
@@ -156,7 +158,7 @@ module Ansi
156
158
  elsif index > @cursor_line_index
157
159
  (index - @cursor_line_index).times { tty.print CODES[:cursor_down] }
158
160
  else
159
- row_before_going = `bash position.sh`.to_i
161
+ row_before_going = cursor_row
160
162
  (@cursor_line_index - index).times do |step|
161
163
  tty.print(`tput ri`) if step >= row_before_going
162
164
  tty.print CODES[:cursor_up]
@@ -179,6 +181,11 @@ module Ansi
179
181
  text.size >= @columns ? text[0...(@columns - 2)] + '…' : text
180
182
  end
181
183
 
184
+ # @return [Fixnum]
185
+ def cursor_row
186
+ `bash #{POSITION_SCRIPT_PATH}`.to_i
187
+ end
188
+
182
189
  # @param [String] text
183
190
  #
184
191
  # @return [String]
@@ -1,5 +1,5 @@
1
1
  module Ansi
2
2
  class Selector
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansi-select
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volodymyr Shatskyi