summaryrefslogtreecommitdiff
path: root/src/evalfunc.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2023-04-24 21:09:54 +0100
committerBram Moolenaar <Bram@vim.org>2023-04-24 21:09:54 +0100
commit67672ef097dd708244ff042a8364994da2b91e75 (patch)
tree728d6713562555f7917bf5297c6ff27b2bb0c792 /src/evalfunc.c
parente1b4822137b74d45fde1d47d2e32b3ae89966092 (diff)
downloadvim-git-67672ef097dd708244ff042a8364994da2b91e75.tar.gz
patch 9.0.1485: no functions for converting from/to UTF-16 indexv9.0.1485
Problem: no functions for converting from/to UTF-16 index. Solution: Add UTF-16 flag to existing funtions and add strutf16len() and utf16idx(). (Yegappan Lakshmanan, closes #12216)
Diffstat (limited to 'src/evalfunc.c')
-rw-r--r--src/evalfunc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 5c10f1ec9..10d00d5a1 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -1751,9 +1751,9 @@ static funcentry_T global_functions[] =
ret_number, f_bufwinnr},
{"byte2line", 1, 1, FEARG_1, arg1_number,
ret_number, f_byte2line},
- {"byteidx", 2, 2, FEARG_1, arg2_string_number,
+ {"byteidx", 2, 3, FEARG_1, arg3_string_number_bool,
ret_number, f_byteidx},
- {"byteidxcomp", 2, 2, FEARG_1, arg2_string_number,
+ {"byteidxcomp", 2, 3, FEARG_1, arg3_string_number_bool,
ret_number, f_byteidxcomp},
{"call", 2, 3, FEARG_1, arg3_any_list_dict,
ret_any, f_call},
@@ -1803,7 +1803,7 @@ static funcentry_T global_functions[] =
ret_number, f_charclass},
{"charcol", 1, 2, FEARG_1, arg2_string_or_list_number,
ret_number, f_charcol},
- {"charidx", 2, 3, FEARG_1, arg3_string_number_bool,
+ {"charidx", 2, 4, FEARG_1, arg3_string_number_bool,
ret_number, f_charidx},
{"chdir", 1, 1, FEARG_1, arg1_string,
ret_string, f_chdir},
@@ -2601,6 +2601,8 @@ static funcentry_T global_functions[] =
ret_number, f_strridx},
{"strtrans", 1, 1, FEARG_1, arg1_string,
ret_string, f_strtrans},
+ {"strutf16len", 1, 2, FEARG_1, arg2_string_bool,
+ ret_number, f_strutf16len},
{"strwidth", 1, 1, FEARG_1, arg1_string,
ret_number, f_strwidth},
{"submatch", 1, 2, FEARG_1, arg2_number_bool,
@@ -2785,6 +2787,8 @@ static funcentry_T global_functions[] =
ret_dict_any, f_undotree},
{"uniq", 1, 3, FEARG_1, arg13_sortuniq,
ret_first_arg, f_uniq},
+ {"utf16idx", 2, 4, FEARG_1, arg3_string_number_bool,
+ ret_number, f_utf16idx},
{"values", 1, 1, FEARG_1, arg1_dict_any,
ret_list_member, f_values},
{"virtcol", 1, 2, FEARG_1, arg2_string_or_list_bool,