unicode-display_width 1.2.0 β 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +92 -0
- data/README.md +2 -2
- data/lib/unicode/display_width.rb +1 -1
- data/lib/unicode/display_width/constants.rb +1 -1
- data/spec/display_width_spec.rb +4 -0
- data/unicode-display_width.gemspec +1 -1
- metadata +4 -4
- data/CHANGELOG.txt +0 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59a04bf566614743afd62208520c6cd793f778ab
|
4
|
+
data.tar.gz: da69bc1f400f8e5f4ee6087e689c88a62cb721e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c1154b63e02f4bd8fbb1e9c1da384fb4bbf3d535d26b87121a708a429835e40e44577caf002db4e1762b909fda88c2ff675d070e9efb1438d0d5714df093b64
|
7
|
+
data.tar.gz: e22f62ff134532d4adfa275e2e6a2eef4b9566b58211b53b45af859e69fd59a67f497bde40943493bb068e1af385d41d9478d646a6c3d28ddd50e3660233f86c
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## 1.2.1
|
4
|
+
|
5
|
+
- Fix bug that `emoji: true` would fail for emoji without modifier
|
6
|
+
|
7
|
+
## 1.2.0
|
8
|
+
|
9
|
+
- Add zero-width codepoint ranges: U+2060..U+206F, U+FFF0..U+FFF8, U+E0000..U+E0FFF
|
10
|
+
- Add full-witdh codepoint ranges: U+3400..U+4DBF, U+4E00..U+9FFF, U+F900..U+FAFF, U+20000..U+2FFFD, U+30000..U+3FFFD
|
11
|
+
- Experimental emoji support using the [unicode-emoji](https://github.com/janlelis/unicode-emoji) gem
|
12
|
+
- Fix minor bug in index compression scheme
|
13
|
+
|
14
|
+
## 1.1.3
|
15
|
+
|
16
|
+
- Fix that non-UTF-8 encodings do not throw errors, patch by @windwiny
|
17
|
+
|
18
|
+
## 1.1.2
|
19
|
+
|
20
|
+
- Reduce memory consumption and increase performance, patch by @rrosenblum
|
21
|
+
|
22
|
+
## 1.1.1
|
23
|
+
|
24
|
+
- Always load index into memory, fixes #9
|
25
|
+
|
26
|
+
## 1.1.0
|
27
|
+
|
28
|
+
- Support Unicode 9.0
|
29
|
+
|
30
|
+
## 1.0.5
|
31
|
+
|
32
|
+
- Actually include new index from 1.0.4
|
33
|
+
|
34
|
+
## 1.0.4
|
35
|
+
|
36
|
+
- New index format (much smaller) and internal API changes
|
37
|
+
- Move index generation to a builder plugin for the unicoder gem
|
38
|
+
- No public API changes
|
39
|
+
|
40
|
+
## 1.0.3
|
41
|
+
|
42
|
+
- Avoid circular dependency warning
|
43
|
+
|
44
|
+
## 1.0.2
|
45
|
+
|
46
|
+
- Fix error that gemspec might be invalid under some circumstances (see gh#6)
|
47
|
+
|
48
|
+
## 1.0.1
|
49
|
+
|
50
|
+
- Inofficially allow Ruby 1.9
|
51
|
+
|
52
|
+
## 1.0.0
|
53
|
+
|
54
|
+
- Faster than 0.3.1
|
55
|
+
- Advanced determination of character width
|
56
|
+
- This includes: Treat width of most chars of general categories (Mn, Me, Cf) as 0
|
57
|
+
- This includes: Introduce list of characters with special widths
|
58
|
+
- Allow custom overrides for specific codepoints
|
59
|
+
- Set required Ruby version to 2.0
|
60
|
+
- Add NO_STRING_EXT mode to disable monkey patching
|
61
|
+
- Internal API & index format changed drastically
|
62
|
+
- Remove require 'unicode/display_size' (use 'unicode/display_width' instead)
|
63
|
+
|
64
|
+
## 0.3.1
|
65
|
+
|
66
|
+
- Faster than 0.3.0
|
67
|
+
- Deprecate usage of aliases: String#display_size and String#display_length
|
68
|
+
- Eliminate Ruby warnings (@amatsuda)
|
69
|
+
|
70
|
+
## 0.3.0
|
71
|
+
|
72
|
+
- Update EastAsianWidth from 7.0 to 8.0
|
73
|
+
- Add rake task to update EastAsianWidth.txt
|
74
|
+
- Move code to generate index from library to Rakefile
|
75
|
+
- Update project's meta files
|
76
|
+
- Deprecate requiring 'unicode-display_size'
|
77
|
+
|
78
|
+
## 0.2.0
|
79
|
+
|
80
|
+
- Update EastAsianWidth from 6.0 to 7.0
|
81
|
+
- Don't build index table automatically when not available
|
82
|
+
- Don't include EastAsianWidth.txt in gem (only index)
|
83
|
+
|
84
|
+
|
85
|
+
## 0.1.0
|
86
|
+
|
87
|
+
- Fix github issue #1
|
88
|
+
|
89
|
+
|
90
|
+
## 0.1.0
|
91
|
+
|
92
|
+
- Initial release
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ X | (user defined) | Overwrites any other values
|
|
24
24
|
0 | `"\u{1160}".."\u{11FF}"` | HANGUL JUNGSEONG
|
25
25
|
0 | `"\u{2060}".."\u{206F}"`, `"\u{FFF0}".."\u{FFF8}"`, `"\u{E0000}".."\u{E0FFF}"` | Ignorable ranges
|
26
26
|
2 | East Asian Width: F, W | Full-width characters
|
27
|
-
2 | `"\u{3400}"
|
27
|
+
2 | `"\u{3400}".."\u{4DBF}"`, `"\u{4E00}".."\u{9FFF}"`, `"\u{F900}".."\u{FAFF}"`, `"\u{20000}".."\u{2FFFD}"`, `"\u{30000}".."\u{3FFFD}"` | Full-width ranges
|
28
28
|
1 or 2 | East Asian Width: A | Ambiguous characters, user defined, default: 1
|
29
29
|
1 | All other codepoints | -
|
30
30
|
|
@@ -32,7 +32,7 @@ X | (user defined) | Overwrites any other values
|
|
32
32
|
|
33
33
|
Install the gem with:
|
34
34
|
|
35
|
-
gem install unicode-display_width
|
35
|
+
$ gem install unicode-display_width
|
36
36
|
|
37
37
|
Or add to your Gemfile:
|
38
38
|
|
@@ -31,7 +31,7 @@ module Unicode
|
|
31
31
|
zwj_regex = /(?<=#{ [Unicode::Emoji::ZWJ].pack("U") })./
|
32
32
|
|
33
33
|
string.scan(Unicode::Emoji::REGEX){ |emoji|
|
34
|
-
extra_width += 2 * emoji.
|
34
|
+
extra_width += 2 * emoji.scan(modifier_regex).size
|
35
35
|
|
36
36
|
emoji.scan(zwj_regex){ |zwj_succ|
|
37
37
|
extra_width += self.of(zwj_succ, ambiguous, overwrite)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Unicode
|
2
2
|
module DisplayWidth
|
3
|
-
VERSION = '1.2.
|
3
|
+
VERSION = '1.2.1'
|
4
4
|
UNICODE_VERSION = "9.0.0".freeze
|
5
5
|
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + '/../../../data/').freeze
|
6
6
|
INDEX_FILENAME = (DATA_DIRECTORY + '/display_width.marshal.gz').freeze
|
data/spec/display_width_spec.rb
CHANGED
@@ -148,5 +148,9 @@ describe 'Unicode::DisplayWidth.of' do
|
|
148
148
|
it 'does not count modifiers and zjw sequences for valid emoji' do
|
149
149
|
expect( "π€Ύπ½ββοΈ".display_width(1, {}, emoji: true) ).to eq 2
|
150
150
|
end
|
151
|
+
|
152
|
+
it 'works with flags' do
|
153
|
+
expect( "π΅πΉ".display_width(1, {}, emoji: true) ).to eq 2
|
154
|
+
end
|
151
155
|
end
|
152
156
|
end
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.summary = "Determines the monospace display width of a string in Ruby."
|
11
11
|
s.description = "[Unicode #{Unicode::DisplayWidth::UNICODE_VERSION}] Determines the monospace display width of a string using EastAsianWidth.txt, Unicode general category, and other data."
|
12
12
|
s.files = Dir.glob(%w[{lib,spec}/**/*.rb [A-Z]*.{txt,rdoc} data/display_width.marshal.gz]) + %w{Rakefile unicode-display_width.gemspec}
|
13
|
-
s.extra_rdoc_files = ["README.md", "MIT-LICENSE.txt", "CHANGELOG.
|
13
|
+
s.extra_rdoc_files = ["README.md", "MIT-LICENSE.txt", "CHANGELOG.md"]
|
14
14
|
s.license = 'MIT'
|
15
15
|
s.required_ruby_version = '>= 1.9.3'
|
16
16
|
s.add_development_dependency 'rspec', '~> 3.4'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicode-display_width
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -46,9 +46,9 @@ extensions: []
|
|
46
46
|
extra_rdoc_files:
|
47
47
|
- README.md
|
48
48
|
- MIT-LICENSE.txt
|
49
|
-
- CHANGELOG.
|
49
|
+
- CHANGELOG.md
|
50
50
|
files:
|
51
|
-
- CHANGELOG.
|
51
|
+
- CHANGELOG.md
|
52
52
|
- MIT-LICENSE.txt
|
53
53
|
- README.md
|
54
54
|
- Rakefile
|
data/CHANGELOG.txt
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# CHANGELOG
|
2
|
-
|
3
|
-
## 1.2.0
|
4
|
-
|
5
|
-
- Add zero-width codepoint ranges: U+2060..U+206F, U+FFF0..U+FFF8, U+E0000..U+E0FFF
|
6
|
-
- Add full-witdh codepoint ranges: U+3400..U+4DBF, U+4E00..U+9FFF, U+F900..U+FAFF, U+20000..U+2FFFD, U+30000..U+3FFFD
|
7
|
-
- Experimental emoji support using the [unicode-emoji](https://github.com/janlelis/unicode-emoji) gem
|
8
|
-
- Fix minor bug in index compression scheme
|
9
|
-
|
10
|
-
## 1.1.3
|
11
|
-
|
12
|
-
- Fix that non-UTF-8 encodings do not throw errors, patch by @windwiny
|
13
|
-
|
14
|
-
## 1.1.2
|
15
|
-
|
16
|
-
- Reduce memory consumption and increase performance, patch by @rrosenblum
|
17
|
-
|
18
|
-
## 1.1.1
|
19
|
-
|
20
|
-
* Always load index into memory, fixes #9
|
21
|
-
|
22
|
-
## 1.1.0
|
23
|
-
|
24
|
-
* Support Unicode 9.0
|
25
|
-
|
26
|
-
## 1.0.5
|
27
|
-
|
28
|
-
* Actually include new index from 1.0.4
|
29
|
-
|
30
|
-
## 1.0.4
|
31
|
-
|
32
|
-
* New index format (much smaller) and internal API changes
|
33
|
-
* Move index generation to a builder plugin for the unicoder gem
|
34
|
-
* No public API changes
|
35
|
-
|
36
|
-
## 1.0.3
|
37
|
-
|
38
|
-
* Avoid circular dependency warning
|
39
|
-
|
40
|
-
## 1.0.2
|
41
|
-
|
42
|
-
* Fix error that gemspec might be invalid under some circumstances (see gh#6)
|
43
|
-
|
44
|
-
## 1.0.1
|
45
|
-
|
46
|
-
* Inofficially allow Ruby 1.9
|
47
|
-
|
48
|
-
## 1.0.0
|
49
|
-
|
50
|
-
* Faster than 0.3.1
|
51
|
-
* Advanced determination of character width
|
52
|
-
* This includes: Treat width of most chars of general categories (Mn, Me, Cf) as 0
|
53
|
-
* This includes: Introduce list of characters with special widths
|
54
|
-
* Allow custom overrides for specific codepoints
|
55
|
-
* Set required Ruby version to 2.0
|
56
|
-
* Add NO_STRING_EXT mode to disable monkey patching
|
57
|
-
* Internal API & index format changed drastically
|
58
|
-
* Remove require 'unicode/display_size' (use 'unicode/display_width' instead)
|
59
|
-
|
60
|
-
## 0.3.1
|
61
|
-
|
62
|
-
* Faster than 0.3.0
|
63
|
-
* Deprecate usage of aliases: String#display_size and String#display_length
|
64
|
-
* Eliminate Ruby warnings (@amatsuda)
|
65
|
-
|
66
|
-
## 0.3.0
|
67
|
-
|
68
|
-
* Update EastAsianWidth from 7.0 to 8.0
|
69
|
-
* Add rake task to update EastAsianWidth.txt
|
70
|
-
* Move code to generate index from library to Rakefile
|
71
|
-
* Update project's meta files
|
72
|
-
* Deprecate requiring 'unicode-display_size'
|
73
|
-
|
74
|
-
## 0.2.0
|
75
|
-
|
76
|
-
* Update EastAsianWidth from 6.0 to 7.0
|
77
|
-
* Don't build index table automatically when not available
|
78
|
-
* Don't include EastAsianWidth.txt in gem (only index)
|
79
|
-
|
80
|
-
|
81
|
-
## 0.1.0
|
82
|
-
|
83
|
-
* Fix github issue #1
|
84
|
-
|
85
|
-
|
86
|
-
## 0.1.0
|
87
|
-
|
88
|
-
* Initial release
|