diff --git a/CHANGELOG.md b/CHANGELOG.md index fd7600a..7b0fe3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # CHANGELOG +## 1.8.0 + +- Unicode 14.0 (last release of 1.x) + +## 1.7.0 + +- Unicode 13 + +## 1.6.1 + +- Fix that ambiguous and overwrite options where ignored for emoji-measuring + ## 1.6.0 - Unicode 12.1 diff --git a/README.md b/README.md index c0613f8..dd45b8f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Determines the monospace display width of a string in Ruby. Implementation based on [EastAsianWidth.txt](https://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt) and other data, 100% in Ruby. Other than [wcwidth()](https://github.com/janlelis/wcswidth-ruby), which fulfills a similar purpose, it does not rely on the OS vendor to provide an up-to-date method for measuring string width. -Unicode version: **12.1.0** (May 2019) +Unicode version: **14.0.0** (September 2021) Supported Rubies: **2.7**, **2.6**, **2.5**, **2.4** diff --git a/data/display_width.marshal.gz b/data/display_width.marshal.gz index ed74f45..7d573cb 100644 Binary files a/data/display_width.marshal.gz and b/data/display_width.marshal.gz differ diff --git a/lib/unicode/display_width.rb b/lib/unicode/display_width.rb index 998d323..532223d 100644 --- a/lib/unicode/display_width.rb +++ b/lib/unicode/display_width.rb @@ -19,7 +19,7 @@ def self.of(string, ambiguous = 1, overwrite = {}, options = {}) total_width + (overwrite[codepoint] || width || 1) } - res -= emoji_extra_width_of(string) if options[:emoji] + res -= emoji_extra_width_of(string, ambiguous, overwrite) if options[:emoji] res < 0 ? 0 : res end diff --git a/lib/unicode/display_width/constants.rb b/lib/unicode/display_width/constants.rb index 95c5256..dec3848 100644 --- a/lib/unicode/display_width/constants.rb +++ b/lib/unicode/display_width/constants.rb @@ -1,7 +1,7 @@ module Unicode module DisplayWidth - VERSION = '1.6.0' - UNICODE_VERSION = "12.1.0".freeze + VERSION = '1.8.0' + UNICODE_VERSION = "14.0.0" DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + '/../../../data/').freeze INDEX_FILENAME = (DATA_DIRECTORY + '/display_width.marshal.gz').freeze end diff --git a/spec/display_width_spec.rb b/spec/display_width_spec.rb index 217973c..b32a678 100644 --- a/spec/display_width_spec.rb +++ b/spec/display_width_spec.rb @@ -149,6 +149,10 @@ expect( "πŸ€ΎπŸ½β€β™€οΈ".display_width(1, {}, emoji: true) ).to eq 2 end + it 'respects different ambiguous values' do + expect( "πŸ€ΎπŸ½β€β™€οΈ".display_width(2, {}, emoji: true) ).to eq 2 + end + it 'works with flags' do expect( "πŸ‡΅πŸ‡Ή".display_width(1, {}, emoji: true) ).to eq 2 end pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy