Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set EastAsianWidth::UNICODE_VERSION #586

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions bin/generate_east_asian_width
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ if ARGV.empty?
end

open(ARGV.first, 'rt') do |f|
if m = f.gets.match(/^# EastAsianWidth-(\d+\.\d+\.\d+)\.txt/)
unicode_version = m[1]
else
warn 'Failed to get UNICODE_VERSION'
unicode_version = nil
end

list = []
f.each_line do |line|
next unless m = line.match(/^(\h+)(?:\.\.(\h+))?\s*;\s*(\w+)\s+#.+/)
Expand Down Expand Up @@ -44,6 +51,7 @@ open(ARGV.first, 'rt') do |f|
class Reline::Unicode::EastAsianWidth
# This is based on EastAsianWidth.txt
# #{ARGV.first}
# UNICODE_VERSION = #{unicode_version ? "'#{unicode_version}'" : 'nil'}

EOH
puts grouped.map { |item|
Expand Down
1 change: 1 addition & 0 deletions lib/reline/unicode/east_asian_width.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class Reline::Unicode::EastAsianWidth
# This is based on EastAsianWidth.txt
# EastAsianWidth.txt
# UNICODE_VERSION = '15.0.0'

# Fullwidth
TYPE_F = /^[#{ %W(
Expand Down