unicode-display_width 3.1.4 → 3.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dadf5b8337ac74b8e5af2a6cd481708c39050506440ccf5d30c6cdc9eb5ade3
4
- data.tar.gz: ae3bb12a0fabe7a53a1b533909f42a86f1fc7acecc33c9b57218ed3607f71d3c
3
+ metadata.gz: 7c14109c1e795b4a3704c22d98253b3283a630d9fe3d1d0c04710d718673ca5b
4
+ data.tar.gz: 744619a90fb70a43988c0635ea5f237eee5c3ff3de2d879b55378d2ea3b1ebad
5
5
  SHA512:
6
- metadata.gz: 414227480c3ae2ca0afcee225bb68b6506ac2f7dac630422db87c0a6d28d9d921bcc4645146ffa0a75ace5eb338dc71df2f051aeb0732824dbf1c7bb3117ba22
7
- data.tar.gz: 1002b3752d47df6f3d416d378148af38ff7c92698a118aded36f55e3b6bbdc99a29552fdee792636d5edea1ce2104266b1dcf9198631a7669334a48fa425af29
6
+ metadata.gz: 2c93aaaec7313fa62ccd8db2ee4de5fab5a757c5cea5e211305da0b55c80ba4d8523db42f100a2d1957d6c3b5a072ff49ecbcce618a02c313d62123ca324492d
7
+ data.tar.gz: d9c8e89ec9c5602a22205d5c17fe761ae2570b86566ebc6f840706a6ee11976dffb8c2dcf04549abfef0d8d6723297b8ef74249c3f95b862622f198f9cba6564
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 3.1.5
4
+
5
+ - Cache Emoji support level for performance reasons #30, patch by @Earlopain:
6
+
3
7
  ## 3.1.4
4
8
 
5
9
  - Fix that skin tone modifiers were ignored when used in a non-ZWJ sequence
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Unicode::DisplayWidth [![[version]](https://badge.fury.io/rb/unicode-display_width.svg)](https://badge.fury.io/rb/unicode-display_width) [<img src="https://github.com/janlelis/unicode-display_width/workflows/Test/badge.svg" />](https://github.com/janlelis/unicode-display_width/actions?query=workflow%3ATest)
2
2
 
3
- Determines the monospace display width of a string in Ruby, which is useful for all kinds of terminal-based applications. The implementation is based on [EastAsianWidth.txt](https://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt), the [Emoji specfication](https://www.unicode.org/reports/tr51/) and other data, 100% in Ruby. It does not rely on the OS vendor ([wcwidth()](https://github.com/janlelis/wcswidth-ruby)) to provide an up-to-date method for measuring string width in terminals.
3
+ Determines the monospace display width of a string in Ruby, which is useful for all kinds of terminal-based applications. The implementation is based on [EastAsianWidth.txt](https://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt), the [Emoji specfication](https://www.unicode.org/reports/tr51/) and other data, 100% in Ruby. It does not rely on the OS vendor ([wcwidth](https://github.com/janlelis/wcswidth-ruby)) to provide an up-to-date method for measuring string width in terminals.
4
4
 
5
5
  Unicode version: **16.0.0** (September 2024)
6
6
 
@@ -108,8 +108,8 @@ Emoji Type | Width / Comment
108
108
  Basic/Single Emoji character without Variation Selector | No special handling
109
109
  Basic/Single Emoji character with VS15 (Text) | No special handling
110
110
  Basic/Single Emoji character with VS16 (Emoji) | 2 or East Asian Width (see table below)
111
- Single Emoji character with Skin Tone Modifier | 2
112
- Skin Tone Modifier used in isolation or with invalid base | 2 if Emoji mode is configured to `:rgi` / `:rgi_at`
111
+ Single Emoji character with Skin Tone Modifier | 2 unless Emoji mode is `:none` or `vs16`
112
+ Skin Tone Modifier used in isolation or with invalid base | 2 if Emoji mode is `:rgi` / `:rgi_at`
113
113
  Emoji Sequence | 2 if Emoji belongs to configured Emoji set (see table below)
114
114
 
115
115
  #### Emoji Modes
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Unicode
4
4
  class DisplayWidth
5
- VERSION = "3.1.4"
5
+ VERSION = "3.1.5"
6
6
  UNICODE_VERSION = "16.0.0"
7
7
  DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../../../data/")
8
8
  INDEX_FILENAME = DATA_DIRECTORY + "/display_width.marshal.gz"
@@ -1,5 +1,4 @@
1
- # require "rbconfig"
2
- # RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ # windows
1
+ # frozen_string_literal: true
3
2
 
4
3
  module Unicode
5
4
  class DisplayWidth
@@ -13,6 +12,10 @@ module Unicode
13
12
  # Please note: Many terminals do not set any ENV vars,
14
13
  # maybe CSI queries can help?
15
14
  def self.recommended
15
+ @recommended ||= _recommended
16
+ end
17
+
18
+ def self._recommended
16
19
  if ENV["CI"]
17
20
  return :rqi
18
21
  end
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: 3.1.4
4
+ version: 3.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Lelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-13 00:00:00.000000000 Z
11
+ date: 2025-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unicode-emoji