aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-06-12 21:14:03 +0200
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-06-28 19:47:39 +0200
commit496091b63241f33dffc15411e35e89d8018e6fa2 (patch)
treea2db095e447e59d77fc3aada1f411d6418f69134
parent32e16cb0b6b046ba45d3e14c0fdb0383ad8bee1e (diff)
downloadrneovim-496091b63241f33dffc15411e35e89d8018e6fa2.tar.gz
rneovim-496091b63241f33dffc15411e35e89d8018e6fa2.tar.bz2
rneovim-496091b63241f33dffc15411e35e89d8018e6fa2.zip
refactor: replace utf_convert with utf8proc conversion functions
-rw-r--r--src/nvim/generators/gen_unicode_tables.lua15
-rw-r--r--src/nvim/mbyte.c7
2 files changed, 6 insertions, 16 deletions
diff --git a/src/nvim/generators/gen_unicode_tables.lua b/src/nvim/generators/gen_unicode_tables.lua
index 6cedb5db50..305b64b7be 100644
--- a/src/nvim/generators/gen_unicode_tables.lua
+++ b/src/nvim/generators/gen_unicode_tables.lua
@@ -5,13 +5,13 @@
-- (A) east asian width respectively.
-- 2. combining table: same as the above, but characters inside are combining
-- characters (i.e. have general categories equal to Mn, Mc or Me).
--- 3. foldCase, toLower and toUpper tables used to convert characters to
--- folded/lower/upper variants. In these tables first two values are
+-- 3. foldCase table used to convert characters to
+-- folded variants. In this table first two values are
-- character ranges: like in previous tables they are sorted and must be
-- non-overlapping. Third value means step inside the range: e.g. if it is
-- 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
--- folded/lower/upper codepoint.
+-- folded codepoint.
-- 4. emoji_wide and emoji_all tables: sorted lists of non-overlapping closed
-- intervals of Emoji characters. emoji_wide contains all the characters
-- which don't have ambiguous or double width, and emoji_all has all Emojis.
@@ -129,13 +129,6 @@ local build_convert_table = function(ut_fp, props, cond_func, nl_index, table_na
ut_fp:write('};\n')
end
-local build_case_table = function(ut_fp, dataprops, table_name, index)
- local cond_func = function(p)
- return p[index] ~= ''
- end
- return build_convert_table(ut_fp, dataprops, cond_func, index, 'to' .. table_name)
-end
-
local build_fold_table = function(ut_fp, foldprops)
local cond_func = function(p)
return (p[2] == 'C' or p[2] == 'S')
@@ -296,8 +289,6 @@ ud_fp:close()
local ut_fp = io.open(utf_tables_fname, 'w')
-build_case_table(ut_fp, dataprops, 'Lower', 14)
-build_case_table(ut_fp, dataprops, 'Upper', 13)
build_combining_table(ut_fp, dataprops)
local cf_fp = io.open(casefolding_fname, 'r')
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 7975f351ee..c0bbd3e053 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <utf8proc.h>
#include <uv.h>
#include <wctype.h>
@@ -1346,8 +1347,7 @@ int mb_toupper(int a)
return TOUPPER_LOC(a);
}
- // For any other characters use the above mapping table.
- return utf_convert(a, toUpper, ARRAY_SIZE(toUpper));
+ return utf8proc_toupper(a);
}
bool mb_islower(int a)
@@ -1374,8 +1374,7 @@ int mb_tolower(int a)
return TOLOWER_LOC(a);
}
- // For any other characters use the above mapping table.
- return utf_convert(a, toLower, ARRAY_SIZE(toLower));
+ return utf8proc_tolower(a);
}
bool mb_isupper(int a)