unicode-display_width 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +9 -5
- data/lib/unicode/display_width/constants.rb +1 -1
- data/lib/unicode/display_width.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dadf5b8337ac74b8e5af2a6cd481708c39050506440ccf5d30c6cdc9eb5ade3
|
4
|
+
data.tar.gz: ae3bb12a0fabe7a53a1b533909f42a86f1fc7acecc33c9b57218ed3607f71d3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 414227480c3ae2ca0afcee225bb68b6506ac2f7dac630422db87c0a6d28d9d921bcc4645146ffa0a75ace5eb338dc71df2f051aeb0732824dbf1c7bb3117ba22
|
7
|
+
data.tar.gz: 1002b3752d47df6f3d416d378148af38ff7c92698a118aded36f55e3b6bbdc99a29552fdee792636d5edea1ce2104266b1dcf9198631a7669334a48fa425af29
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 3.1.4
|
4
|
+
|
5
|
+
- Fix that skin tone modifiers were ignored when used in a non-ZWJ sequence
|
6
|
+
context (= single emoji char + modifier) #29
|
7
|
+
- Add more docs and specs about modifier handling
|
8
|
+
|
3
9
|
## 3.1.3
|
4
10
|
|
5
11
|
Better handling of non-UTF-8 strings, patch by @Earlopain:
|
data/README.md
CHANGED
@@ -101,12 +101,16 @@ There are many Emoji which get constructed by combining other Emoji in a sequenc
|
|
101
101
|
|
102
102
|
Another aspect where terminals disagree is whether Emoji characters which have a text presentation by default (width 1) should be turned into full-width (width 2) when combined with Variation Selector 16 (*U+FEOF*).
|
103
103
|
|
104
|
+
Finally, it varies if Skin Tone Modifiers can be applied to all characters or just to those with the "Emoji Base" property.
|
105
|
+
|
104
106
|
Emoji Type | Width / Comment
|
105
107
|
------------|----------------
|
106
|
-
Basic/Single Emoji character without Variation Selector
|
107
|
-
Basic/Single Emoji character with VS15 (Text)
|
108
|
-
Basic/Single Emoji character with VS16 (Emoji)
|
109
|
-
|
108
|
+
Basic/Single Emoji character without Variation Selector | No special handling
|
109
|
+
Basic/Single Emoji character with VS15 (Text) | No special handling
|
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`
|
113
|
+
Emoji Sequence | 2 if Emoji belongs to configured Emoji set (see table below)
|
110
114
|
|
111
115
|
#### Emoji Modes
|
112
116
|
|
@@ -131,7 +135,7 @@ The `emoji:` option can be used to configure which type of Emoji should be consi
|
|
131
135
|
|
132
136
|
Unfortunately, the level of Emoji support varies a lot between terminals. While some of them are able to display (almost) all Emoji sequences correctly, others fall back to displaying sequences of basic Emoji. When `emoji: true` or `emoji: :auto` is used, the gem will attempt to set the best fitting Emoji setting for you (e.g. `:rgi_at` on "Apple_Terminal" or `false` on Gnome's terminal widget).
|
133
137
|
|
134
|
-
Please note that Emoji display and number of terminal columns used might differs a lot. For example, it might be the case that a terminal does not understand which Emoji to display, but still manages to calculate the proper amount of terminal cells. The automatic Emoji support level per terminal only considers the latter (cursor position), not the actual Emoji image(s) displayed. Please [open an issue](https://github.com/janlelis/unicode-display_width/issues/new) if you notice your terminal application could use a better default value. Also see the [ucs-detect project](https://ucs-detect.readthedocs.io/results.html), which is a great resource that compares various terminal's Unicode/Emoji capabilities. You can
|
138
|
+
Please note that Emoji display and number of terminal columns used might differs a lot. For example, it might be the case that a terminal does not understand which Emoji to display, but still manages to calculate the proper amount of terminal cells. The automatic Emoji support level per terminal only considers the latter (cursor position), not the actual Emoji image(s) displayed. Please [open an issue](https://github.com/janlelis/unicode-display_width/issues/new) if you notice your terminal application could use a better default value. Also see the [ucs-detect project](https://ucs-detect.readthedocs.io/results.html), which is a great resource that compares various terminal's Unicode/Emoji capabilities. You can visually check how your terminals renders different kind of Emoji types with the [terminal-emoji-width.rb script](https://github.com/janlelis/unicode-display_width/blob/main/misc/terminal-emoji-width.rb).
|
135
139
|
|
136
140
|
**To terminal implementors reading this:** Although the practice of giving all Emoji/ZWJ sequences a width of 2 (`:all` mode described above) has some advantages, it does not lead to a particularly good developer experience. Since there is always the possibility of well-formed Emoji that are currently not supported (non-RGI / future Unicode) appearing, those sequences will take more cells. Instead of overflowing, cutting off sequences or displaying placeholder-Emoji, could it be worthwile to implement the `:rgi` option (only known Emoji get width 2) and give those unknown Emoji the space they need? This would support the idea that the meaning of an unknown Emoji sequence can still be conveyed (without messing up the terminal at the same time). Just a thought…
|
137
141
|
|
@@ -42,7 +42,9 @@ module Unicode
|
|
42
42
|
),
|
43
43
|
Unicode::Emoji::REGEX_EMOJI_KEYCAP
|
44
44
|
)
|
45
|
-
|
45
|
+
|
46
|
+
# ebase = Unicode::Emoji::REGEX_PROP_MODIFIER_BASE.source
|
47
|
+
REGEX_EMOJI_ALL_SEQUENCES = Regexp.union(/.[\u{1F3FB}-\u{1F3FF}\u{FE0F}]?(\u{200D}.[\u{1F3FB}-\u{1F3FF}\u{FE0F}]?)+|.[\u{1F3FB}-\u{1F3FF}]/, Unicode::Emoji::REGEX_EMOJI_KEYCAP)
|
46
48
|
REGEX_EMOJI_ALL_SEQUENCES_AND_VS16 = Regexp.union(REGEX_EMOJI_ALL_SEQUENCES, REGEX_EMOJI_VS16)
|
47
49
|
|
48
50
|
# Returns monospace display width of string
|
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
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unicode-emoji
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
|
-
rubygems_version: 3.
|
107
|
+
rubygems_version: 3.5.21
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: Determines the monospace display width of a string in Ruby.
|