Patch 8.2.3226
Problem: New digraph functions use old naming scheme.
Solution: Use the digraph_ prefix. (Hirohito Higashi, closes #8580)
Files: runtime/doc/digraph.txt, runtime/doc/eval.txt,
runtime/doc/usr_41.txt, src/digraph.c, src/edit.c, src/errors.h,
src/evalfunc.c, src/proto/
digraph.pro,
src/testdir/test_digraph.vim
*** ../vim-8.2.3225/runtime/doc/digraph.txt 2021-07-19 20:07:16.693295633 +0200
--- runtime/doc/digraph.txt 2021-07-26 21:42:55.104966083 +0200
***************
*** 40,46 ****
future.
NOTE: This command cannot add a digraph that starts
with a white space. If you want to add such digraph,
! you can use |setdigraph()| instead.
Vim is normally compiled with the |+digraphs| feature. If the feature is
disabled, the ":digraph" command will display an error message.
--- 40,46 ----
future.
NOTE: This command cannot add a digraph that starts
with a white space. If you want to add such digraph,
! you can use |digraph_set()| instead.
Vim is normally compiled with the |+digraphs| feature. If the feature is
disabled, the ":digraph" command will display an error message.
*** ../vim-8.2.3225/runtime/doc/eval.txt 2021-07-19 20:07:16.697295626 +0200
--- runtime/doc/eval.txt 2021-07-26 21:42:55.108966074 +0200
***************
*** 2531,2536 ****
--- 2548,2557 ----
did_filetype() Number |TRUE| if FileType autocmd event used
diff_filler({lnum}) Number diff filler lines about {lnum}
diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
+ digraph_get({chars}) String get the digraph of {chars}
+ digraph_getlist([{listall}]) List get all |digraph|s
+ digraph_set({chars}, {digraph}) Boolean register |digraph|
+ digraph_setlist({digraphlist}) Boolean register multiple |digraph|s
echoraw({expr}) none output {expr} as-is
empty({expr}) Number |TRUE| if {expr} is empty
environ() Dict return environment variables
***************
*** 2603,2610 ****
getcurpos([{winnr}]) List position of the cursor
getcursorcharpos([{winnr}]) List character position of the cursor
getcwd([{winnr} [, {tabnr}]]) String get the current working directory
- getdigraph({chars}) String get the digraph of {chars}
- getdigraphlist([{listall}]) List get all |digraph|s
getenv({name}) String return environment variable
getfontname([{name}]) String name of font being used
getfperm({fname}) String file permissions of file {fname}
--- 2624,2629 ----
***************
*** 2871,2878 ****
setcharsearch({dict}) Dict set character search from {dict}
setcmdpos({pos}) Number set cursor position in command-line
setcursorcharpos({list}) Number move cursor to position in {list}
- setdigraph({chars}, {digraph}) Boolean register |digraph|
- setdigraphlist({digraphlist}) Boolean register multiple |digraph|s
setenv({name}, {val}) none set environment variable
setfperm({fname}, {mode}) Number set {fname} file permissions to {mode}
setline({lnum}, {line}) Number set line {lnum} to {line}
--- 2890,2895 ----
***************
*** 4181,4186 ****
--- 4203,4309 ----
Can also be used as a |method|: >
GetLnum()->diff_hlID(col)
+ <
+
+ digraph_get({chars}) *digraph_get()* *E1214*
+ Return the digraph of {chars}. This should be a string with
+ exactly two characters. If {chars} are not just two
+ characters, or the digraph of {chars} does not exist, an error
+ is given and an empty string is returned.
+
+ The character will be converted from Unicode to 'encoding'
+ when needed. This does require the conversion to be
+ available, it might fail.
+
+ Also see |digraph_getlist()|.
+
+ Examples: >
+ " Get a built-in digraph
+ :echo digraph_get('00') " Returns '∞'
+
+ " Get a user-defined digraph
+ :call digraph_set('aa', 'あ')
+ :echo digraph_get('aa') " Returns 'あ'
+ <
+ Can also be used as a |method|: >
+ GetChars()->digraph_get()
+ <
+ This function works only when compiled with the |+digraphs|
+ feature. If this feature is disabled, this function will
+ display an error message.
+
+
+ digraph_getlist([{listall}]) *digraph_getlist()*
+ Return a list of digraphs. If the {listall} argument is given
+ and it is TRUE, return all digraphs, including the default
+ digraphs. Otherwise, return only user-defined digraphs.
+
+ The characters will be converted from Unicode to 'encoding'
+ when needed. This does require the conservation to be
+ available, it might fail.
+
+ Also see |digraph_get()|.
+
+ Examples: >
+ " Get user-defined digraphs
+ :echo digraph_getlist()
+
+ " Get all the digraphs, including default digraphs
+ :echo digraph_getlist(1)
+ <
+ Can also be used as a |method|: >
+ GetNumber()->digraph_getlist()
+ <
+ This function works only when compiled with the |+digraphs|
+ feature. If this feature is disabled, this function will
+ display an error message.
+
+
+ digraph_set({chars}, {digraph}) *digraph_set()* *E1205*
+ Add digraph {chars} to the list. {chars} must be a string
+ with two characters. {digraph} is a string with one utf-8
+ encoded character. Be careful, composing characters are NOT
+ ignored. This function is similar to |:digraphs| command, but
+ useful to add digraphs start with a white space.
+
+ The function result is v:true if |digraph| is registered. If
+ this fails an error message is given and v:false is returned.
+
+ If you want to define multiple digraphs at once, you can use
+ |digraph_setlist()|.
+
+ Example: >
+ call digraph_set(' ', 'あ')
+ <
+ Can be used as a |method|: >
+ GetString()->digraph_set('あ')
+ <
+ This function works only when compiled with the |+digraphs|
+ feature. If this feature is disabled, this function will
+ display an error message.
+
+
+ digraph_setlist({digraphlist}) *digraph_setlist()*
+ Similar to |digraph_set()| but this function can add multiple
+ digraphs at once. {digraphlist} is a list composed of lists,
+ where each list contains two strings with {chars} and
+ {digraph} as in |digraph_set()|.
+ Example: >
+ call digraph_setlist([['aa', 'あ'], ['ii', 'い']])
+ <
+ It is similar to the following: >
+ for [chars, digraph] in [['aa', 'あ'], ['ii', 'い']]
+ call digraph_set(chars, digraph)
+ endfor
+ < Except that the function returns after the first error,
+ following digraphs will not be added.
+
+ Can be used as a |method|: >
+ GetList()->digraph_setlist()
+ <
+ This function works only when compiled with the |+digraphs|
+ feature. If this feature is disabled, this function will
+ display an error message.
echoraw({expr}) *echoraw()*
***************
*** 5545,5605 ****
< Can also be used as a |method|: >
GetWinnr()->getcwd()
- <
- *getdigraph()* *E1214*
- getdigraph({chars})
- Return the digraph of {chars}. This should be a string with
- exactly two characters. If {chars} are not just two
- characters, or the digraph of {chars} does not exist, an error
- is given and an empty string is returned.
-
- The character will be converted from Unicode to 'encoding'
- when needed. This does require the conversion to be
- available, it might fail.
-
- Also see |getdigraphlist()|.
-
- Examples: >
- " Get a built-in digraph
- :echo getdigraph('00') " Returns '∞'
-
- " Get a user-defined digraph
- :call setdigraph('aa', 'あ')
- :echo getdigraph('aa') " Returns 'あ'
- <
- Can also be used as a |method|: >
- GetChars()->getdigraph()
- <
- This function works only when compiled with the |+digraphs|
- feature. If this feature is disabled, this function will
- display an error message.
-
-
- getdigraphlist([{listall}]) *getdigraphlist()*
- Return a list of digraphs. If the {listall} argument is given
- and it is TRUE, return all digraphs, including the default
- digraphs. Otherwise, return only user-defined digraphs.
-
- The characters will be converted from Unicode to 'encoding'
- when needed. This does require the conservation to be
- available, it might fail.
-
- Also see |getdigraph()|.
-
- Examples: >
- " Get user-defined digraphs
- :echo getdigraphlist()
-
- " Get all the digraphs, including default digraphs
- :echo digraphlist(1)
- <
- Can also be used as a |method|: >
- GetNumber()->getdigraphlist()
- <
- This function works only when compiled with the |+digraphs|
- feature. If this feature is disabled, this function will
- display an error message.
-
getenv({name}) *getenv()*
Return the value of environment variable {name}.
--- 5686,5691 ----
***************
*** 9505,9557 ****
GetCursorPos()->setcursorcharpos()
- setdigraph({chars}, {digraph}) *setdigraph()* *E1205*
- Add digraph {chars} to the list. {chars} must be a string
- with two characters. {digraph} is a string with one utf-8
- encoded character. Be careful, composing characters are NOT
- ignored. This function is similar to |:digraphs| command, but
- useful to add digraphs start with a white space.
-
- The function result is v:true if |digraph| is registered. If
- this fails an error message is given and v:false is returned.
-
- If you want to define multiple digraphs at once, you can use
- |setdigraphlist()|.
-
- Example: >
- call setdigraph(' ', 'あ')
- <
- Can be used as a |method|: >
- GetString()->setdigraph('あ')
- <
- This function works only when compiled with the |+digraphs|
- feature. If this feature is disabled, this function will
- display an error message.
-
-
- setdigraphlist({digraphlist}) *setdigraphlist()*
- Similar to |setdigraph()| but this function can add multiple
- digraphs at once. {digraphlist} is a list composed of lists,
- where each list contains two strings with {chars} and
- {digraph} as in |setdigraph()|.
- Example: >
- call setdigraphlist([['aa', 'あ'], ['ii', 'い']])
- <
- It is similar to the following: >
- for [chars, digraph] in [['aa', 'あ'], ['ii', 'い']]
- call setdigraph(chars, digraph)
- endfor
- < Except that the function returns after the first error,
- following digraphs will not be added.
-
- Can be used as a |method|: >
- GetList()->setdigraphlist()
- <
- This function works only when compiled with the |+digraphs|
- feature. If this feature is disabled, this function will
- display an error message.
-
-
setenv({name}, {val}) *setenv()*
Set environment variable {name} to {val}.
When {val} is |v:null| the environment variable is deleted.
--- 9628,9633 ----
*** ../vim-8.2.3225/runtime/doc/usr_41.txt 2021-07-19 20:07:16.697295626 +0200
--- runtime/doc/usr_41.txt 2021-07-26 21:42:55.108966074 +0200
***************
*** 986,1001 ****
winrestview() restore saved view of current window
Mappings and Menus: *mapping-functions*
hasmapto() check if a mapping exists
mapcheck() check if a matching mapping exists
maparg() get rhs of a mapping
mapset() restore a mapping
menu_info() get information about a menu item
wildmenumode() check if the wildmode is active
- getdigraph() get |digraph|
- getdigraphlist() get all |digraph|s
- setdigraph() register |digraph|
- setdigraphlist() register multiple |digraph|s
Testing: *test-functions*
assert_equal() assert that two expressions values are equal
--- 994,1009 ----
winrestview() restore saved view of current window
Mappings and Menus: *mapping-functions*
+ digraph_get() get |digraph|
+ digraph_getlist() get all |digraph|s
+ digraph_set() register |digraph|
+ digraph_setlist() register multiple |digraph|s
hasmapto() check if a mapping exists
mapcheck() check if a matching mapping exists
maparg() get rhs of a mapping
mapset() restore a mapping
menu_info() get information about a menu item
wildmenumode() check if the wildmode is active
Testing: *test-functions*
assert_equal() assert that two expressions values are equal
*** ../vim-8.2.3225/src/digraph.c 2021-07-20 21:07:32.960058864 +0200
--- src/digraph.c 2021-07-26 21:42:55.108966074 +0200
***************
*** 1781,1787 ****
else if (p_dg)
{
if (backspaced >= 0)
! c = getdigraph(backspaced, c, FALSE);
backspaced = -1;
if ((c == K_BS || c == Ctrl_H) && lastchar >= 0)
backspaced = lastchar;
--- 1781,1787 ----
else if (p_dg)
{
if (backspaced >= 0)
! c = digraph_get(backspaced, c, FALSE);
backspaced = -1;
if ((c == K_BS || c == Ctrl_H) && lastchar >= 0)
backspaced = lastchar;
***************
*** 1887,1893 ****
--no_mapping;
--allow_keys;
if (cc != ESC) // ESC cancels CTRL-K
! return getdigraph(c, cc, TRUE);
}
return NUL;
}
--- 1887,1893 ----
--no_mapping;
--allow_keys;
if (cc != ESC) // ESC cancels CTRL-K
! return digraph_get(c, cc, TRUE);
}
return NUL;
}
***************
*** 1981,1987 ****
* Allow for both char1-char2 and char2-char1
*/
int
! getdigraph(int char1, int char2, int meta_char)
{
int retval;
--- 1981,1987 ----
* Allow for both char1-char2 and char2-char1
*/
int
! digraph_get(int char1, int char2, int meta_char)
{
int retval;
***************
*** 2143,2149 ****
}
static void
! getdigraphlist_appendpair(digr_T *dp, list_T *l)
{
char_u buf[30];
char_u *p;
--- 2143,2149 ----
}
static void
! digraph_getlist_appendpair(digr_T *dp, list_T *l)
{
char_u buf[30];
char_u *p;
***************
*** 2194,2200 ****
}
void
! getdigraphlist_common(int list_all, typval_T *rettv)
{
int i;
digr_T *dp;
--- 2194,2200 ----
}
void
! digraph_getlist_common(int list_all, typval_T *rettv)
{
int i;
digr_T *dp;
***************
*** 2215,2225 ****
tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
if (tmp.result != 0 && tmp.result != tmp.char2
&& (has_mbyte || tmp.result <= 255))
! getdigraphlist_appendpair(&tmp, rettv->vval.v_list);
#else
if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
&& (has_mbyte || dp->result <= 255))
! getdigraphlist_appendpair(dp, rettv->vval.v_list);
#endif
++dp;
}
--- 2215,2225 ----
tmp.result = getexactdigraph(tmp.char1, tmp.char2, FALSE);
if (tmp.result != 0 && tmp.result != tmp.char2
&& (has_mbyte || tmp.result <= 255))
! digraph_getlist_appendpair(&tmp, rettv->vval.v_list);
#else
if (getexactdigraph(dp->char1, dp->char2, FALSE) == dp->result
&& (has_mbyte || dp->result <= 255))
! digraph_getlist_appendpair(dp, rettv->vval.v_list);
#endif
++dp;
}
***************
*** 2228,2234 ****
dp = (digr_T *)user_digraphs.ga_data;
for (i = 0; i < user_digraphs.ga_len && !got_int; ++i)
{
! getdigraphlist_appendpair(dp, rettv->vval.v_list);
++dp;
}
}
--- 2228,2234 ----
dp = (digr_T *)user_digraphs.ga_data;
for (i = 0; i < user_digraphs.ga_len && !got_int; ++i)
{
! digraph_getlist_appendpair(dp, rettv->vval.v_list);
++dp;
}
}
***************
*** 2363,2369 ****
}
static int
! setdigraph_common(typval_T *argchars, typval_T *argdigraph)
{
int char1, char2;
char_u *digraph;
--- 2363,2369 ----
}
static int
! digraph_set_common(typval_T *argchars, typval_T *argdigraph)
{
int char1, char2;
char_u *digraph;
***************
*** 2394,2403 ****
#if defined(FEAT_EVAL) || defined(PROTO)
/*
! * "getdigraph()" function
*/
void
! f_getdigraph(typval_T *argvars, typval_T *rettv)
{
# ifdef FEAT_DIGRAPHS
int code;
--- 2394,2403 ----
#if defined(FEAT_EVAL) || defined(PROTO)
/*
! * "digraph_get()" function
*/
void
! f_digraph_get(typval_T *argvars, typval_T *rettv)
{
# ifdef FEAT_DIGRAPHS
int code;
***************
*** 2415,2421 ****
semsg(_(e_digraph_must_be_just_two_characters_str), digraphs);
return;
}
! code = getdigraph(digraphs[0], digraphs[1], FALSE);
if (has_mbyte)
buf[(*mb_char2bytes)(code, buf)] = NUL;
--- 2415,2421 ----
semsg(_(e_digraph_must_be_just_two_characters_str), digraphs);
return;
}
! code = digraph_get(digraphs[0], digraphs[1], FALSE);
if (has_mbyte)
buf[(*mb_char2bytes)(code, buf)] = NUL;
***************
*** 2431,2440 ****
}
/*
! * "getdigraphlist()" function
*/
void
! f_getdigraphlist(typval_T *argvars, typval_T *rettv)
{
# ifdef FEAT_DIGRAPHS
int flag_list_all;
--- 2431,2440 ----
}
/*
! * "digraph_getlist()" function
*/
void
! f_digraph_getlist(typval_T *argvars, typval_T *rettv)
{
# ifdef FEAT_DIGRAPHS
int flag_list_all;
***************
*** 2450,2472 ****
flag_list_all = flag ? TRUE : FALSE;
}
! getdigraphlist_common(flag_list_all, rettv);
# else
emsg(_(e_no_digraphs_version));
# endif
}
/*
! * "setdigraph()" function
*/
void
! f_setdigraph(typval_T *argvars, typval_T *rettv)
{
# ifdef FEAT_DIGRAPHS
rettv->v_type = VAR_BOOL;
rettv->vval.v_number = VVAL_FALSE;
! if (!setdigraph_common(&argvars[0], &argvars[1]))
return;
rettv->vval.v_number = VVAL_TRUE;
--- 2450,2472 ----
flag_list_all = flag ? TRUE : FALSE;
}
! digraph_getlist_common(flag_list_all, rettv);
# else
emsg(_(e_no_digraphs_version));
# endif
}
/*
! * "digraph_set()" function
*/
void
! f_digraph_set(typval_T *argvars, typval_T *rettv)
{
# ifdef FEAT_DIGRAPHS
rettv->v_type = VAR_BOOL;
rettv->vval.v_number = VVAL_FALSE;
! if (!digraph_set_common(&argvars[0], &argvars[1]))
return;
rettv->vval.v_number = VVAL_TRUE;
***************
*** 2476,2485 ****
}
/*
! * "setdigraphlist()" function
*/
void
! f_setdigraphlist(typval_T * argvars, typval_T *rettv)
{
# ifdef FEAT_DIGRAPHS
list_T *pl, *l;
--- 2476,2485 ----
}
/*
! * "digraph_setlist()" function
*/
void
! f_digraph_setlist(typval_T * argvars, typval_T *rettv)
{
# ifdef FEAT_DIGRAPHS
list_T *pl, *l;
***************
*** 2490,2496 ****
if (argvars[0].v_type != VAR_LIST)
{
! emsg(_(e_setdigraphlist_argument_must_be_list_of_lists_with_two_items));
return;
}
--- 2490,2496 ----
if (argvars[0].v_type != VAR_LIST)
{
! emsg(_(e_digraph_setlist_argument_must_be_list_of_lists_with_two_items));
return;
}
***************
*** 2506,2523 ****
{
if (pli->li_tv.v_type != VAR_LIST)
{
! emsg(_(e_setdigraphlist_argument_must_be_list_of_lists_with_two_items));
return;
}
l = pli->li_tv.vval.v_list;
if (l == NULL || l->lv_len != 2)
{
! emsg(_(e_setdigraphlist_argument_must_be_list_of_lists_with_two_items));
return;
}
! if (!setdigraph_common(&l->lv_first->li_tv,
&l->lv_first->li_next->li_tv))
return;
}
--- 2506,2523 ----
{
if (pli->li_tv.v_type != VAR_LIST)
{
! emsg(_(e_digraph_setlist_argument_must_be_list_of_lists_with_two_items));
return;
}
l = pli->li_tv.vval.v_list;
if (l == NULL || l->lv_len != 2)
{
! emsg(_(e_digraph_setlist_argument_must_be_list_of_lists_with_two_items));
return;
}
! if (!digraph_set_common(&l->lv_first->li_tv,
&l->lv_first->li_next->li_tv))
return;
}
*** ../vim-8.2.3225/src/edit.c 2021-07-21 22:20:30.062401737 +0200
--- src/edit.c 2021-07-26 21:42:55.108966074 +0200
***************
*** 5219,5225 ****
if (cc != ESC)
{
AppendToRedobuff((char_u *)CTRL_V_STR);
! c = getdigraph(c, cc, TRUE);
#ifdef FEAT_CMDL_INFO
clear_showcmd();
#endif
--- 5219,5225 ----
if (cc != ESC)
{
AppendToRedobuff((char_u *)CTRL_V_STR);
! c = digraph_get(c, cc, TRUE);
#ifdef FEAT_CMDL_INFO
clear_showcmd();
#endif
*** ../vim-8.2.3225/src/errors.h 2021-07-23 20:37:52.018322443 +0200
--- src/errors.h 2021-07-26 21:42:55.108966074 +0200
***************
*** 610,617 ****
INIT(= N_("E1214: Digraph must be just two characters: %s"));
EXTERN char e_digraph_argument_must_be_one_character_str[]
INIT(= N_("E1215: Digraph must be one character: %s"));
! EXTERN char e_setdigraphlist_argument_must_be_list_of_lists_with_two_items[]
! INIT(= N_("E1216: setdigraphlist() argument must be a list of lists with two items"));
#endif
EXTERN char e_chan_or_job_required_for_argument_nr[]
INIT(= N_("E1217: Channel or Job required for argument %d"));
--- 610,617 ----
INIT(= N_("E1214: Digraph must be just two characters: %s"));
EXTERN char e_digraph_argument_must_be_one_character_str[]
INIT(= N_("E1215: Digraph must be one character: %s"));
! EXTERN char e_digraph_setlist_argument_must_be_list_of_lists_with_two_items[]
! INIT(= N_("E1216: digraph_setlist() argument must be a list of lists with two items"));
#endif
EXTERN char e_chan_or_job_required_for_argument_nr[]
INIT(= N_("E1217: Channel or Job required for argument %d"));
*** ../vim-8.2.3225/src/evalfunc.c 2021-07-25 15:57:29.218219920 +0200
--- src/evalfunc.c 2021-07-26 21:42:55.108966074 +0200
***************
*** 1292,1297 ****
--- 1292,1305 ----
ret_number, f_diff_filler},
{"diff_hlID", 2, 2, FEARG_1, arg2_lnum_number,
ret_number, f_diff_hlID},
+ {"digraph_get", 1, 1, FEARG_1, arg1_string,
+ ret_string, f_digraph_get},
+ {"digraph_getlist",0, 1, FEARG_1, arg1_number,
+ ret_list_string_items, f_digraph_getlist},
+ {"digraph_set", 2, 2, FEARG_1, arg2_string_number,
+ ret_bool, f_digraph_set},
+ {"digraph_setlist",1, 1, FEARG_1, arg1_list_string,
+ ret_bool, f_digraph_setlist},
{"echoraw", 1, 1, FEARG_1, arg1_string,
ret_void, f_echoraw},
{"empty", 1, 1, FEARG_1, NULL,
***************
*** 1406,1415 ****
ret_list_number, f_getcursorcharpos},
{"getcwd", 0, 2, FEARG_1, arg2_number,
ret_string, f_getcwd},
- {"getdigraph", 1, 1, FEARG_1, arg1_string,
- ret_string, f_getdigraph},
- {"getdigraphlist", 0, 1, FEARG_1, arg1_number,
- ret_list_string_items, f_getdigraphlist},
{"getenv", 1, 1, FEARG_1, arg1_string,
ret_any, f_getenv},
{"getfontname", 0, 1, 0, arg1_string,
--- 1414,1419 ----
***************
*** 1870,1879 ****
ret_number_bool, f_setcmdpos},
{"setcursorcharpos", 1, 3, FEARG_1, arg13_cursor,
ret_number_bool, f_setcursorcharpos},
- {"setdigraph", 2, 2, FEARG_1, arg2_string_number,
- ret_bool, f_setdigraph},
- {"setdigraphlist", 1, 1, FEARG_1, arg1_list_string,
- ret_bool, f_setdigraphlist},
{"setenv", 2, 2, FEARG_2, arg2_string_any,
ret_void, f_setenv},
{"setfperm", 2, 2, FEARG_1, arg2_string,
--- 1874,1879 ----
*** ../vim-8.2.3225/src/proto/
digraph.pro 2021-07-19 20:07:16.701295618 +0200
--- src/proto/
digraph.pro 2021-07-26 21:42:55.108966074 +0200
***************
*** 2,16 ****
int do_digraph(int c);
char_u *get_digraph_for_char(int val_arg);
int get_digraph(int cmdline);
! int getdigraph(int char1, int char2, int meta_char);
int check_digraph_chars_valid(int char1, int char2);
void putdigraph(char_u *str);
void listdigraphs(int use_headers);
! void getdigraphlist_common(int list_all, typval_T *rettv);
! void f_getdigraph(typval_T *argvars, typval_T *rettv);
! void f_getdigraphlist(typval_T *argvars, typval_T *rettv);
! void f_setdigraph(typval_T *argvars, typval_T *rettv);
! void f_setdigraphlist(typval_T *argvars, typval_T *rettv);
char *keymap_init(void);
void ex_loadkeymap(exarg_T *eap);
void keymap_clear(garray_T *kmap);
--- 2,16 ----
int do_digraph(int c);
char_u *get_digraph_for_char(int val_arg);
int get_digraph(int cmdline);
! int digraph_get(int char1, int char2, int meta_char);
int check_digraph_chars_valid(int char1, int char2);
void putdigraph(char_u *str);
void listdigraphs(int use_headers);
! void digraph_getlist_common(int list_all, typval_T *rettv);
! void f_digraph_get(typval_T *argvars, typval_T *rettv);
! void f_digraph_getlist(typval_T *argvars, typval_T *rettv);
! void f_digraph_set(typval_T *argvars, typval_T *rettv);
! void f_digraph_setlist(typval_T *argvars, typval_T *rettv);
char *keymap_init(void);
void ex_loadkeymap(exarg_T *eap);
void keymap_clear(garray_T *kmap);
*** ../vim-8.2.3225/src/testdir/test_digraph.vim 2021-07-19 20:07:16.701295618 +0200
--- src/testdir/test_digraph.vim 2021-07-26 21:42:55.108966074 +0200
***************
*** 515,595 ****
call StopVimInTerminal(buf)
endfunc
! func Test_setdigraph_function()
new
! call setdigraph('aa', 'あ')
call Put_Dig('aa')
call assert_equal('あ', getline('$'))
! call setdigraph(' i', 'い')
call Put_Dig(' i')
call assert_equal('い', getline('$'))
! call setdigraph(' ', 'う')
call Put_Dig(' ')
call assert_equal('う', getline('$'))
! eval 'aa'->setdigraph('え')
call Put_Dig('aa')
call assert_equal('え', getline('$'))
! call assert_fails('call setdigraph("aaa", "あ")', 'E1214: Digraph must be just two characters: aaa')
! call assert_fails('call setdigraph("b", "あ")', 'E1214: Digraph must be just two characters: b')
! call assert_fails('call setdigraph("あ", "あ")', 'E1214: Digraph must be just two characters: あ')
! call assert_fails('call setdigraph("aa", "ああ")', 'E1215: Digraph must be one character: ああ')
! call assert_fails('call setdigraph("aa", "か" .. nr2char(0x3099))', 'E1215: Digraph must be one character: か' .. nr2char(0x3099))
bwipe!
endfunc
! func Test_getdigraph_function()
" Built-in digraphs
! call assert_equal('∞', getdigraph('00'))
" User-defined digraphs
! call setdigraph('aa', 'あ')
! call setdigraph(' i', 'い')
! call setdigraph(' ', 'う')
! call assert_equal('あ', getdigraph('aa'))
! call assert_equal('あ', 'aa'->getdigraph())
! call assert_equal('い', getdigraph(' i'))
! call assert_equal('う', getdigraph(' '))
! call assert_fails('call getdigraph("aaa")', 'E1214: Digraph must be just two characters: aaa')
! call assert_fails('call getdigraph("b")', 'E1214: Digraph must be just two characters: b')
endfunc
! func Test_getdigraph_function_encode()
CheckFeature iconv
let testcases = {
\'00': '∞',
\'aa': 'あ',
\}
for [key, ch] in items(testcases)
! call setdigraph(key, ch)
set encoding=japan
! call assert_equal(iconv(ch, 'utf-8', 'japan'), getdigraph(key))
set encoding&
endfor
endfunc
! func Test_setdigraphlist_function()
! call setdigraphlist([['aa', 'き'], ['bb', 'く']])
! call assert_equal('き', getdigraph('aa'))
! call assert_equal('く', getdigraph('bb'))
! call assert_fails('call setdigraphlist([[]])', 'E1216:')
! call assert_fails('call setdigraphlist([["aa", "b", "cc"]])', '1216:')
! call assert_fails('call setdigraphlist([["あ", "あ"]])', 'E1214: Digraph must be just two characters: あ')
endfunc
! func Test_getdigraphlist_function()
" Make sure user-defined digraphs are defined
! call setdigraphlist([['aa', 'き'], ['bb', 'く']])
! for pair in getdigraphlist(1)
! call assert_equal(getdigraph(pair[0]), pair[1])
endfor
" We don't know how many digraphs are registered before, so check the number
" of digraphs returned.
! call assert_equal(getdigraphlist()->len(), getdigraphlist(0)->len())
! call assert_notequal((getdigraphlist()->len()), getdigraphlist(1)->len())
endfunc
" vim: shiftwidth=2 sts=2 expandtab
--- 515,595 ----
call StopVimInTerminal(buf)
endfunc
! func Test_digraph_set_function()
new
! call digraph_set('aa', 'あ')
call Put_Dig('aa')
call assert_equal('あ', getline('$'))
! call digraph_set(' i', 'い')
call Put_Dig(' i')
call assert_equal('い', getline('$'))
! call digraph_set(' ', 'う')
call Put_Dig(' ')
call assert_equal('う', getline('$'))
! eval 'aa'->digraph_set('え')
call Put_Dig('aa')
call assert_equal('え', getline('$'))
! call assert_fails('call digraph_set("aaa", "あ")', 'E1214: Digraph must be just two characters: aaa')
! call assert_fails('call digraph_set("b", "あ")', 'E1214: Digraph must be just two characters: b')
! call assert_fails('call digraph_set("あ", "あ")', 'E1214: Digraph must be just two characters: あ')
! call assert_fails('call digraph_set("aa", "ああ")', 'E1215: Digraph must be one character: ああ')
! call assert_fails('call digraph_set("aa", "か" .. nr2char(0x3099))', 'E1215: Digraph must be one character: か' .. nr2char(0x3099))
bwipe!
endfunc
! func Test_digraph_get_function()
" Built-in digraphs
! call assert_equal('∞', digraph_get('00'))
" User-defined digraphs
! call digraph_set('aa', 'あ')
! call digraph_set(' i', 'い')
! call digraph_set(' ', 'う')
! call assert_equal('あ', digraph_get('aa'))
! call assert_equal('あ', 'aa'->digraph_get())
! call assert_equal('い', digraph_get(' i'))
! call assert_equal('う', digraph_get(' '))
! call assert_fails('call digraph_get("aaa")', 'E1214: Digraph must be just two characters: aaa')
! call assert_fails('call digraph_get("b")', 'E1214: Digraph must be just two characters: b')
endfunc
! func Test_digraph_get_function_encode()
CheckFeature iconv
let testcases = {
\'00': '∞',
\'aa': 'あ',
\}
for [key, ch] in items(testcases)
! call digraph_set(key, ch)
set encoding=japan
! call assert_equal(iconv(ch, 'utf-8', 'japan'), digraph_get(key))
set encoding&
endfor
endfunc
! func Test_digraph_setlist_function()
! call digraph_setlist([['aa', 'き'], ['bb', 'く']])
! call assert_equal('き', digraph_get('aa'))
! call assert_equal('く', digraph_get('bb'))
! call assert_fails('call digraph_setlist([[]])', 'E1216:')
! call assert_fails('call digraph_setlist([["aa", "b", "cc"]])', '1216:')
! call assert_fails('call digraph_setlist([["あ", "あ"]])', 'E1214: Digraph must be just two characters: あ')
endfunc
! func Test_digraph_getlist_function()
" Make sure user-defined digraphs are defined
! call digraph_setlist([['aa', 'き'], ['bb', 'く']])
! for pair in digraph_getlist(1)
! call assert_equal(digraph_get(pair[0]), pair[1])
endfor
" We don't know how many digraphs are registered before, so check the number
" of digraphs returned.
! call assert_equal(digraph_getlist()->len(), digraph_getlist(0)->len())
! call assert_notequal((digraph_getlist()->len()), digraph_getlist(1)->len())
endfunc
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.3225/src/version.c 2021-07-26 21:11:27.805521168 +0200
--- src/version.c 2021-07-26 21:44:20.768768061 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3226,
/**/
--
hundred-and-one symptoms of being an internet addict:
243. You unsuccessfully try to download a pizza from
www.dominos.com.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///