Skip to content

Commit

Permalink
canvas: update version detection for Unicode 15.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Oct 2, 2023
1 parent 9d84b42 commit 742cf2c
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 13 deletions.
4 changes: 2 additions & 2 deletions blerc.template
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
## tests the behavior of the terminal on startup and try to determine the
## appropriate version. Supported versions are "4.1", "5.0", "5.2", "6.0",
## "6.1", "6.2", "6.3", "7.0", "8.0", "9.0", "10.0", "11.0", "12.0", "12.1",
## "13.0", "14.0", and "15.0". The default value is "auto".
## "13.0", "14.0", "15.0", and "15.1". The default value is "auto".

#bleopt char_width_version=auto

Expand All @@ -414,7 +414,7 @@

## "emoji_version" specifies the version of Unicode Emoji. Available values
## are 0.6, 0.7, 1.0, 2.0, 3.0, 4.0, 5.0, 11.0, 12.0, 12.1, 13.0, 13.1, 14.0,
## and 15.0.
## 15.0, and 15.1.

#bleopt emoji_version=13.1

Expand Down
2 changes: 1 addition & 1 deletion docs/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- make: work around `make-3.81` bug of pattern rules `#D2065` f7ec170b
- decode: work around `convert-meta on` in bash >= 5.2 with broken locale (reported by 3ximus) `#D2069` 226f9718
- canvas: adjust GraphemeClusterBreak of hankaku-kana voiced marks `#D2077` 31d168cc
- canvas: update tables and grapheme clusters for Unicode 15.1.0 `#D2078` xxxxxxxx xxxxxxxx
- canvas: update tables and grapheme clusters for Unicode 15.1.0 `#D2078` 503bb38b 9d84b424 xxxxxxxx

## Contrib

Expand Down
4 changes: 3 additions & 1 deletion lib/test-canvas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ else
fi

(
bleopt grapheme_cluster=extended
# Disable terminal-specific tailored grapheme cluster for testing purpose.
_ble_unicode_GraphemeClusterBreak_custom=()

Expand Down Expand Up @@ -494,8 +495,9 @@ fi

ble/test/start-section 'ble/unicode/GraphemeCluster/c2break (GraphemeBreakTest.txt)' 6244
(
# Disable terminal-specific tailored grapheme cluster for testing purpose.
bleopt grapheme_cluster=extended
_ble_unicode_c2w_version=17 # Test cases contain 15.1.0 features
# Disable terminal-specific tailored grapheme cluster for testing purpose.
_ble_unicode_GraphemeClusterBreak_custom=()

bleopt emoji_opts=ri:tpvs:epvs:zwj
Expand Down
2 changes: 1 addition & 1 deletion make/canvas.c2w.generate-table.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function sub:convert-custom-c2w {
function sub:emoji {
local -x name=${1:-_ble_unicode_EmojiStatus}

local unicode_version=15.0
local unicode_version=15.1
local cache=out/data/unicode-emoji-$unicode_version.txt
download "https://unicode.org/Public/emoji/$unicode_version/emoji-test.txt" "$cache"

Expand Down
10 changes: 10 additions & 0 deletions note.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7152,6 +7152,16 @@ bash_tips
| return "$ext"
| }

2023-10-02 push してから気づいたが detection を更新するのを忘れていた。

2023-10-02 更に emoji table についても更新するのを忘れていた。但し、15.0 と
15.1 には本質的な違いは存在しない様だ。

2023-10-02 blerc.template を更新する。

2023-10-02 GraphemeCluster が legacy が extended かで conjunctCluster を処
理するかどうかも切り替えるべきでは→条件式を追加する事にした。

* ext/fzf: $() は blink-matching-paren on の時 `` より遅い [#D2077]
https://github.com/junegunn/fzf/commit/e0b29e437be458066fca4dab39b282dfc11466f6

Expand Down
5 changes: 3 additions & 2 deletions src/canvas.emoji.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ function ble/unicode/EmojiStatus/version2index {
(13.1) ret=11 ;;
(14.0) ret=12 ;;
(15.0) ret=13 ;;
(15.1) ret=14 ;;
(*) return 1 ;;
esac
}
_ble_unicode_EmojiStatus_version=13
bleopt/declare -n emoji_version 15.0
_ble_unicode_EmojiStatus_version=14
bleopt/declare -n emoji_version 15.1
16 changes: 10 additions & 6 deletions src/canvas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function ble/unicode/c2w {
## @bleopt emoji_version
##
## ファイル src/canvas.emoji.sh は以下のコマンドで生成する。
## $ ./make_command.sh update-emoji-database
## $ make/canvas.c2w.generate-table.sh emoji
##
#%< canvas.emoji.sh

Expand Down Expand Up @@ -414,14 +414,14 @@ function ble/util/c2w:auto/test.buff {
# index=0,1 [EastAsianWidth=A 判定]
0x25bd 0x25b6

# index=2..15 [Unicode version 判定] #D1645 #D1668
# index=2..16 [Unicode version 判定] #D1645 #D1668
# 判定用の文字コードは "source
# make/canvas.c2w.list-ucsver-detection-codes.sh" を用いて生
# 成されたリストから選択した。新しい Unicode version が出たら
# 再びこれを実行して判定コードを書く事になる。
0x9FBC 0x9FC4 0x31B8 0xD7B0 0x3099
0x9FCD 0x1F93B 0x312E 0x312F 0x16FE2
0x32FF 0x31BB 0x9FFD 0x1B132)
0x32FF 0x31BB 0x9FFD 0x1B132 0x2FFC)

_ble_util_c2w_auto_update_processing=${#codes[@]}
_ble_util_c2w_auto_update_result=()
Expand Down Expand Up @@ -466,7 +466,9 @@ function ble/util/c2w/test.hook {
local ws
if [[ $bleopt_char_width_version == auto ]]; then
ws=("${_ble_util_c2w_auto_update_result[@]:2}")
if ((ws[13]==2)); then
if ((ws[14]==2)); then
bleopt char_width_version=15.1
elif ((ws[13]==2)); then
bleopt char_width_version=15.0
elif ((ws[11]==2)); then
if ((ws[12]==2)); then
Expand Down Expand Up @@ -810,7 +812,7 @@ function ble/unicode/GraphemeCluster/find-previous-boundary/.RI {
## とします。
function ble/unicode/GraphemeCluster/find-previous-boundary/.InCB {
# Grapheme Cluster with InCB is supported by Unicode >= 15.1.0
if ((_ble_unicode_c2w_version<17)); then
if [[ $bleopt_grapheme_cluster != extended ]] || ((_ble_unicode_c2w_version<17)); then
ret=$i
return 0
fi
Expand Down Expand Up @@ -990,7 +992,9 @@ function ble/unicode/GraphemeCluster/match {
(3) [[ :$bleopt_emoji_opts: == *:zwj:* ]] &&
((coreb==_ble_unicode_GraphemeClusterBreak_Pictographic)) || break ;;
(4) [[ :$bleopt_emoji_opts: == *:ri:* && ! $ri ]] || break; ri=1 ;;
(6) ((_ble_unicode_c2w_version>=17&&InCB_state)) || break ;;
(6) [[ $bleopt_grapheme_cluster == extended ]] &&
((_ble_unicode_c2w_version>=17&&InCB_state)) ||
break ;;
(5)
# surrogate pair の間にいた時は GraphemeClusterBreak を取得し直す
ble/unicode/GraphemeCluster/s2break-left "$text" "$((j+shift))" code; c2=$code b2=$ret ;;
Expand Down

0 comments on commit 742cf2c

Please sign in to comment.