howzit 1.2.9 → 1.2.10

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
  SHA256:
3
- metadata.gz: 311a04719d7aa7de00e54224eda363bc249dd6f8e3fdd31ad5d2a625eaa8bff8
4
- data.tar.gz: 87f632ce5ac4855880b5d7ddade20983c42b252fa51bbf7fd0b654cf389970ff
3
+ metadata.gz: fba37c5c428aeab92ed337697a52323d5b98d5f9398776187e000043e3a5173b
4
+ data.tar.gz: 6f3a3ebfe50f50476837c2d702cd1c9854d49ff4960c51a06641e79d88abb410
5
5
  SHA512:
6
- metadata.gz: 3ef0f06a0d408c652ae516e92d78dbb7d6bd6bf48260cb21dd66e63f4ecf27c38eed30eae42b79c53f87a824e8622b93416aef7e29feae25d2003ed00827332d
7
- data.tar.gz: 16025164eb7fb5550058e361fd478b7b37e4e560cbb1b06965c79a9f091df2862d0387cd908cdfcc11456a7b358f3f507ee876036f95190971acdaa610aa979a
6
+ metadata.gz: 015bc504dca39d5b7a32b6d81a4df037abf61467f58b392e88389557f38a2abfb078fd3dc5ced7411b5d1654479d5a79b94da843f8384d4cf77216e9efa1c24c
7
+ data.tar.gz: c0b2003e8c1b24efa1e193520a66e01813fab6e9d8e21318a7d0c82718540fa8ef1c99b075d40dc07254c678015ca3fe687b64a2be6f8ce541c22e786ac63c9a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ### 1.2.10
2
+
3
+ 2022-08-01 07:45
4
+
5
+ #### FIXED
6
+
7
+ - Headline formatting when iTerm markers are inserted
8
+
1
9
  ### 1.2.9
2
10
 
3
11
  2022-08-01 07:09
@@ -132,8 +132,12 @@ module Howzit
132
132
  end
133
133
  end
134
134
 
135
+ def should_mark_iterm?
136
+ ENV['TERM_PROGRAM'] =~ /^iTerm/ && !@options[:run] && !@options[:paginate]
137
+ end
138
+
135
139
  def iterm_marker
136
- "\e]1337;SetMark\a\n" if ENV['TERM_PROGRAM'] =~ /^iTerm/ && !@options[:run] && !@options[:paginate]
140
+ "\e]1337;SetMark\a" if should_mark_iterm?
137
141
  end
138
142
 
139
143
  def color_single_options(choices = %w[y n])
@@ -226,16 +230,23 @@ module Howzit
226
230
  options = {
227
231
  hr: "\u{254C}",
228
232
  color: '1;32',
229
- border: '0'
233
+ border: '0',
234
+ mark: false
230
235
  }
231
236
 
232
237
  options.merge!(opts)
233
238
 
234
239
  cols = TTY::Screen.columns
240
+
235
241
  cols = @options[:wrap] if (@options[:wrap]).positive? && cols > @options[:wrap]
236
- title = "\e[#{options[:border]}m#{options[:hr]}#{options[:hr]}( \e[#{options[:color]}m#{title}\e[#{options[:border]}m )"
237
- tail = options[:hr] * (cols - title.uncolor.length)
238
- options[:hr] =~ /╌/ ? "#{iterm_marker}#{title}#{tail}\e[0m" : "#{title}#{tail}\e[0m"
242
+ title = "\e[#{options[:border]}m#{options[:hr] * 2}( \e[#{options[:color]}m#{title}\e[#{options[:border]}m )"
243
+
244
+ tail = if should_mark_iterm?
245
+ "#{options[:hr] * (cols - title.uncolor.length - 15)}#{options[:mark] ? iterm_marker : ''}"
246
+ else
247
+ options[:hr] * (cols - title.uncolor.length)
248
+ end
249
+ "#{title}#{tail}\e[0m"
239
250
  end
240
251
 
241
252
  def os_open(command)
@@ -344,7 +355,7 @@ module Howzit
344
355
 
345
356
  output = []
346
357
  if opt[:header]
347
- output.push(format_header(key))
358
+ output.push(format_header(key, { mark: should_mark_iterm? }))
348
359
  output.push('')
349
360
  end
350
361
  topic = topics[key].strip
@@ -2,5 +2,5 @@
2
2
  # Primary module for this gem.
3
3
  module Howzit
4
4
  # Current Howzit version.
5
- VERSION = '1.2.9'.freeze
5
+ VERSION = '1.2.10'.freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra