mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.1642
Problem: Handling emoji characters as full width has problems with
backwards compatibility.
Solution: Only put characters in the 1f000 range in the emoji table.
6a08454b93
This commit is contained in:
parent
e161d6a19d
commit
dafca1ad68
@ -12,8 +12,9 @@
|
|||||||
-- 2 then interval applies only to first, third, fifth, … character in range.
|
-- 2 then interval applies only to first, third, fifth, … character in range.
|
||||||
-- Fourth value is number that should be added to the codepoint to yield
|
-- Fourth value is number that should be added to the codepoint to yield
|
||||||
-- folded/lower/upper codepoint.
|
-- folded/lower/upper codepoint.
|
||||||
-- 4. emoji_tab table: sorted list of non-overlapping closed intervals of Emoji
|
-- 4. emoji_width and emoji_all tables: sorted lists of non-overlapping closed
|
||||||
-- characters
|
-- intervals of Emoji characters. emoji_width contains all the characters
|
||||||
|
-- which don't have ambiguous or double width, and emoji_all has all Emojis.
|
||||||
if arg[1] == '--help' then
|
if arg[1] == '--help' then
|
||||||
print('Usage:')
|
print('Usage:')
|
||||||
print(' genunicodetables.lua UnicodeData.txt CaseFolding.txt ' ..
|
print(' genunicodetables.lua UnicodeData.txt CaseFolding.txt ' ..
|
||||||
@ -242,29 +243,34 @@ local build_emoji_table = function(ut_fp, emojiprops, doublewidth, ambiwidth)
|
|||||||
else
|
else
|
||||||
table.insert(emoji, { n, n_last })
|
table.insert(emoji, { n, n_last })
|
||||||
end
|
end
|
||||||
-- exclude characters that are in the ambiguous/doublewidth table
|
|
||||||
for _, ambi in ipairs(ambiwidth) do
|
|
||||||
if n >= ambi[1] and n <= ambi[2] then
|
|
||||||
n = ambi[2] + 1
|
|
||||||
end
|
|
||||||
if n_last >= ambi[1] and n_last <= ambi[2] then
|
|
||||||
n_last = ambi[1] - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for _, double in ipairs(doublewidth) do
|
|
||||||
if n >= double[1] and n <= double[2] then
|
|
||||||
n = double[2] + 1
|
|
||||||
end
|
|
||||||
if n_last >= double[1] and n_last <= double[2] then
|
|
||||||
n_last = double[1] - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if n <= n_last then
|
-- Characters below 1F000 may be considered single width traditionally,
|
||||||
if #emojiwidth > 0 and n - 1 == emojiwidth[#emojiwidth][2] then
|
-- making them double width causes problems.
|
||||||
emojiwidth[#emojiwidth][2] = n_last
|
if n >= 0x1f000 then
|
||||||
else
|
-- exclude characters that are in the ambiguous/doublewidth table
|
||||||
table.insert(emojiwidth, { n, n_last })
|
for _, ambi in ipairs(ambiwidth) do
|
||||||
|
if n >= ambi[1] and n <= ambi[2] then
|
||||||
|
n = ambi[2] + 1
|
||||||
|
end
|
||||||
|
if n_last >= ambi[1] and n_last <= ambi[2] then
|
||||||
|
n_last = ambi[1] - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, double in ipairs(doublewidth) do
|
||||||
|
if n >= double[1] and n <= double[2] then
|
||||||
|
n = double[2] + 1
|
||||||
|
end
|
||||||
|
if n_last >= double[1] and n_last <= double[2] then
|
||||||
|
n_last = double[1] - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if n <= n_last then
|
||||||
|
if #emojiwidth > 0 and n - 1 == emojiwidth[#emojiwidth][2] then
|
||||||
|
emojiwidth[#emojiwidth][2] = n_last
|
||||||
|
else
|
||||||
|
table.insert(emojiwidth, { n, n_last })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -801,7 +801,7 @@ static int included_patches[] = {
|
|||||||
// 1645,
|
// 1645,
|
||||||
// 1644,
|
// 1644,
|
||||||
1643,
|
1643,
|
||||||
// 1642,
|
1642,
|
||||||
1641,
|
1641,
|
||||||
// 1640,
|
// 1640,
|
||||||
// 1639,
|
// 1639,
|
||||||
|
Loading…
Reference in New Issue
Block a user