natty-ui 0.11.0 → 0.11.2

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.
data/lib/natty-ui/text.rb CHANGED
@@ -42,8 +42,8 @@ module NattyUI
42
42
  # works for UTF-8 chars only!
43
43
  def char_width(char)
44
44
  ord = char.ord
45
- return SPECIAL_CHARS[ord] || 2 if ord <= 0x1f
46
- return 1 if ord <= 0x7e
45
+ return WIDTH_CONTROL_CHARS[ord] || 2 if ord < 0x20
46
+ return 1 if ord < 0xa1
47
47
  size = EastAsianWidth[ord]
48
48
  return @ambiguous_char_width if size == -1
49
49
  if size == 1 && char.size >= 2
@@ -158,7 +158,7 @@ module NattyUI
158
158
  UTF_8 = Encoding::UTF_8
159
159
  BBCODE = /(?:\[((?~[\[\]]))\])/
160
160
  WIDTH_SCANNER = /\G(?:(\1)|(\2)|(#{Ansi::CSI})|(#{Ansi::OSC})|(\X))/
161
- SPECIAL_CHARS = {
161
+ WIDTH_CONTROL_CHARS = {
162
162
  0x00 => 0,
163
163
  0x01 => 1,
164
164
  0x02 => 1,
@@ -2,5 +2,5 @@
2
2
 
3
3
  module NattyUI
4
4
  # The version number of the gem.
5
- VERSION = '0.11.0'
5
+ VERSION = '0.11.2'
6
6
  end
@@ -16,7 +16,7 @@ module NattyUI
16
16
  # # => apple banana blueberry pineapple strawberry
17
17
  #
18
18
  # @example (unordered) list with red dot
19
- # ui.ls('apple', 'banana', 'blueberry', 'pineapple', 'strawberry', glyph: '[[red]]•[[/]]')
19
+ # ui.ls('apple', 'banana', 'blueberry', 'pineapple', 'strawberry', glyph: '[red]•[/]')
20
20
  # # => • apple • banana • blueberry • pineapple • strawberry
21
21
  #
22
22
  # @example ordered list
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: natty-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Blumtritt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-08-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  This is the beautiful, nice, nifty, fancy, neat, pretty, cool, lovely,
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubygems_version: 3.5.16
99
+ rubygems_version: 3.5.17
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: This is the beautiful, nice, nifty, fancy, neat, pretty, cool, lovely, natty