# HG changeset patch # User Bram Moolenaar # Date 1627329607 -7200 # Node ID 890fd82112020796fe4e935279364a292db099c7 # Parent 5197d46bc088848310ca45ae2b00aca226dfc9e0 patch 8.2.3226: new digraph functions use old naming scheme Commit: https://github.com/vim/vim/commit/29b857150c111a455f1a38a8f748243524f692e1 Author: h-east Date: Mon Jul 26 21:54:04 2021 +0200 patch 8.2.3226: new digraph functions use old naming scheme Problem: New digraph functions use old naming scheme. Solution: Use the digraph_ prefix. (Hirohito Higashi, closes https://github.com/vim/vim/issues/8580) diff --git a/runtime/doc/digraph.txt b/runtime/doc/digraph.txt --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -40,7 +40,7 @@ 1. Defining digraphs *digraphs-defin 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. + 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. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2548,6 +2548,10 @@ deletebufline({expr}, {first} [, {last}] 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 @@ -2620,8 +2624,6 @@ getcompletion({pat}, {type} [, {filtered 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} @@ -2888,8 +2890,6 @@ setcharpos({expr}, {list}) Number set th 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} @@ -4198,6 +4198,107 @@ diff_hlID({lnum}, {col}) *diff_hlID() 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()* @@ -5575,61 +5676,6 @@ getcwd([{winnr} [, {tabnr}]]) < 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}. @@ -9550,53 +9596,6 @@ setcursorcharpos({list}) 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. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -994,16 +994,16 @@ Window size and position: *window-size 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 - 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 diff --git a/src/digraph.c b/src/digraph.c --- a/src/digraph.c +++ b/src/digraph.c @@ -1781,7 +1781,7 @@ do_digraph(int c) else if (p_dg) { if (backspaced >= 0) - c = getdigraph(backspaced, c, FALSE); + c = digraph_get(backspaced, c, FALSE); backspaced = -1; if ((c == K_BS || c == Ctrl_H) && lastchar >= 0) backspaced = lastchar; @@ -1887,7 +1887,7 @@ get_digraph( --no_mapping; --allow_keys; if (cc != ESC) // ESC cancels CTRL-K - return getdigraph(c, cc, TRUE); + return digraph_get(c, cc, TRUE); } return NUL; } @@ -1981,7 +1981,7 @@ getexactdigraph(int char1, int char2, in * Allow for both char1-char2 and char2-char1 */ int -getdigraph(int char1, int char2, int meta_char) +digraph_get(int char1, int char2, int meta_char) { int retval; @@ -2143,7 +2143,7 @@ listdigraphs(int use_headers) } static void -getdigraphlist_appendpair(digr_T *dp, list_T *l) +digraph_getlist_appendpair(digr_T *dp, list_T *l) { char_u buf[30]; char_u *p; @@ -2194,7 +2194,7 @@ getdigraphlist_appendpair(digr_T *dp, li } void -getdigraphlist_common(int list_all, typval_T *rettv) +digraph_getlist_common(int list_all, typval_T *rettv) { int i; digr_T *dp; @@ -2215,11 +2215,11 @@ getdigraphlist_common(int list_all, typv 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); + digraph_getlist_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); + digraph_getlist_appendpair(dp, rettv->vval.v_list); #endif ++dp; } @@ -2228,7 +2228,7 @@ getdigraphlist_common(int list_all, typv 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); + digraph_getlist_appendpair(dp, rettv->vval.v_list); ++dp; } } @@ -2363,7 +2363,7 @@ get_digraph_chars(typval_T *arg, int *ch } static int -setdigraph_common(typval_T *argchars, typval_T *argdigraph) +digraph_set_common(typval_T *argchars, typval_T *argdigraph) { int char1, char2; char_u *digraph; @@ -2394,10 +2394,10 @@ setdigraph_common(typval_T *argchars, ty #if defined(FEAT_EVAL) || defined(PROTO) /* - * "getdigraph()" function + * "digraph_get()" function */ void -f_getdigraph(typval_T *argvars, typval_T *rettv) +f_digraph_get(typval_T *argvars, typval_T *rettv) { # ifdef FEAT_DIGRAPHS int code; @@ -2415,7 +2415,7 @@ f_getdigraph(typval_T *argvars, typval_T semsg(_(e_digraph_must_be_just_two_characters_str), digraphs); return; } - code = getdigraph(digraphs[0], digraphs[1], FALSE); + code = digraph_get(digraphs[0], digraphs[1], FALSE); if (has_mbyte) buf[(*mb_char2bytes)(code, buf)] = NUL; @@ -2431,10 +2431,10 @@ f_getdigraph(typval_T *argvars, typval_T } /* - * "getdigraphlist()" function + * "digraph_getlist()" function */ void -f_getdigraphlist(typval_T *argvars, typval_T *rettv) +f_digraph_getlist(typval_T *argvars, typval_T *rettv) { # ifdef FEAT_DIGRAPHS int flag_list_all; @@ -2450,23 +2450,23 @@ f_getdigraphlist(typval_T *argvars, typv flag_list_all = flag ? TRUE : FALSE; } - getdigraphlist_common(flag_list_all, rettv); + digraph_getlist_common(flag_list_all, rettv); # else emsg(_(e_no_digraphs_version)); # endif } /* - * "setdigraph()" function + * "digraph_set()" function */ void -f_setdigraph(typval_T *argvars, typval_T *rettv) +f_digraph_set(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])) + if (!digraph_set_common(&argvars[0], &argvars[1])) return; rettv->vval.v_number = VVAL_TRUE; @@ -2476,10 +2476,10 @@ f_setdigraph(typval_T *argvars, typval_T } /* - * "setdigraphlist()" function + * "digraph_setlist()" function */ void -f_setdigraphlist(typval_T * argvars, typval_T *rettv) +f_digraph_setlist(typval_T * argvars, typval_T *rettv) { # ifdef FEAT_DIGRAPHS list_T *pl, *l; @@ -2490,7 +2490,7 @@ f_setdigraphlist(typval_T * argvars, typ if (argvars[0].v_type != VAR_LIST) { - emsg(_(e_setdigraphlist_argument_must_be_list_of_lists_with_two_items)); + emsg(_(e_digraph_setlist_argument_must_be_list_of_lists_with_two_items)); return; } @@ -2506,18 +2506,18 @@ f_setdigraphlist(typval_T * argvars, typ { if (pli->li_tv.v_type != VAR_LIST) { - emsg(_(e_setdigraphlist_argument_must_be_list_of_lists_with_two_items)); + 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_setdigraphlist_argument_must_be_list_of_lists_with_two_items)); + emsg(_(e_digraph_setlist_argument_must_be_list_of_lists_with_two_items)); return; } - if (!setdigraph_common(&l->lv_first->li_tv, + if (!digraph_set_common(&l->lv_first->li_tv, &l->lv_first->li_next->li_tv)) return; } diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -5219,7 +5219,7 @@ ins_digraph(void) if (cc != ESC) { AppendToRedobuff((char_u *)CTRL_V_STR); - c = getdigraph(c, cc, TRUE); + c = digraph_get(c, cc, TRUE); #ifdef FEAT_CMDL_INFO clear_showcmd(); #endif diff --git a/src/errors.h b/src/errors.h --- a/src/errors.h +++ b/src/errors.h @@ -610,8 +610,8 @@ EXTERN char e_digraph_must_be_just_two_c 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")); +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")); diff --git a/src/evalfunc.c b/src/evalfunc.c --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1292,6 +1292,14 @@ static funcentry_T global_functions[] = 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,10 +1414,6 @@ static funcentry_T global_functions[] = 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, @@ -1870,10 +1874,6 @@ static funcentry_T global_functions[] = 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, diff --git a/src/proto/digraph.pro b/src/proto/digraph.pro --- a/src/proto/digraph.pro +++ b/src/proto/digraph.pro @@ -2,15 +2,15 @@ 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 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 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); +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); diff --git a/src/testdir/test_digraph.vim b/src/testdir/test_digraph.vim --- a/src/testdir/test_digraph.vim +++ b/src/testdir/test_digraph.vim @@ -515,81 +515,81 @@ func Test_entering_digraph() call StopVimInTerminal(buf) endfunc -func Test_setdigraph_function() +func Test_digraph_set_function() new - call setdigraph('aa', 'あ') + call digraph_set('aa', 'あ') call Put_Dig('aa') call assert_equal('あ', getline('$')) - call setdigraph(' i', 'い') + call digraph_set(' i', 'い') call Put_Dig(' i') call assert_equal('い', getline('$')) - call setdigraph(' ', 'う') + call digraph_set(' ', 'う') call Put_Dig(' ') call assert_equal('う', getline('$')) - eval 'aa'->setdigraph('え') + eval 'aa'->digraph_set('え') 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)) + 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_getdigraph_function() +func Test_digraph_get_function() " Built-in digraphs - call assert_equal('∞', getdigraph('00')) + call assert_equal('∞', digraph_get('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') + 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_getdigraph_function_encode() +func Test_digraph_get_function_encode() CheckFeature iconv let testcases = { \'00': '∞', \'aa': 'あ', \} for [key, ch] in items(testcases) - call setdigraph(key, ch) + call digraph_set(key, ch) set encoding=japan - call assert_equal(iconv(ch, 'utf-8', 'japan'), getdigraph(key)) + call assert_equal(iconv(ch, 'utf-8', 'japan'), digraph_get(key)) set encoding& endfor endfunc -func Test_setdigraphlist_function() - call setdigraphlist([['aa', 'き'], ['bb', 'く']]) - call assert_equal('き', getdigraph('aa')) - call assert_equal('く', getdigraph('bb')) +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 setdigraphlist([[]])', 'E1216:') - call assert_fails('call setdigraphlist([["aa", "b", "cc"]])', '1216:') - call assert_fails('call setdigraphlist([["あ", "あ"]])', 'E1214: Digraph must be just two characters: あ') + 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_getdigraphlist_function() +func Test_digraph_getlist_function() " Make sure user-defined digraphs are defined - call setdigraphlist([['aa', 'き'], ['bb', 'く']]) + call digraph_setlist([['aa', 'き'], ['bb', 'く']]) - for pair in getdigraphlist(1) - call assert_equal(getdigraph(pair[0]), pair[1]) + 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(getdigraphlist()->len(), getdigraphlist(0)->len()) - call assert_notequal((getdigraphlist()->len()), getdigraphlist(1)->len()) + 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 diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3226, +/**/ 3225, /**/ 3224,