mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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 vim/vim#8580)
29b857150c
This commit is contained in:
parent
cbc54cf484
commit
3b0bcb8ad0
@ -119,6 +119,10 @@ dictwatcherdel({dict}, {pattern}, {callback})
|
|||||||
did_filetype() Number |TRUE| if FileType autocommand event used
|
did_filetype() Number |TRUE| if FileType autocommand event used
|
||||||
diff_filler({lnum}) Number diff filler lines about {lnum}
|
diff_filler({lnum}) Number diff filler lines about {lnum}
|
||||||
diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
|
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
|
||||||
empty({expr}) Number |TRUE| if {expr} is empty
|
empty({expr}) Number |TRUE| if {expr} is empty
|
||||||
environ() Dict return environment variables
|
environ() Dict return environment variables
|
||||||
escape({string}, {chars}) String escape {chars} in {string} with '\'
|
escape({string}, {chars}) String escape {chars} in {string} with '\'
|
||||||
@ -185,8 +189,6 @@ getcompletion({pat}, {type} [, {filtered}])
|
|||||||
getcurpos([{winnr}]) List position of the cursor
|
getcurpos([{winnr}]) List position of the cursor
|
||||||
getcursorcharpos([{winnr}]) List character position of the cursor
|
getcursorcharpos([{winnr}]) List character position of the cursor
|
||||||
getcwd([{winnr} [, {tabnr}]]) String get the current working directory
|
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
|
getenv({name}) String return environment variable
|
||||||
getfontname([{name}]) String name of font being used
|
getfontname([{name}]) String name of font being used
|
||||||
getfperm({fname}) String file permissions of file {fname}
|
getfperm({fname}) String file permissions of file {fname}
|
||||||
@ -404,8 +406,6 @@ setcharpos({expr}, {list}) Number set the {expr} position to {list}
|
|||||||
setcharsearch({dict}) Dict set character search from {dict}
|
setcharsearch({dict}) Dict set character search from {dict}
|
||||||
setcmdpos({pos}) Number set cursor position in command-line
|
setcmdpos({pos}) Number set cursor position in command-line
|
||||||
setcursorcharpos({list}) Number move cursor to position in {list}
|
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
|
setenv({name}, {val}) none set environment variable
|
||||||
setfperm({fname}, {mode} Number set {fname} file permissions to {mode}
|
setfperm({fname}, {mode} Number set {fname} file permissions to {mode}
|
||||||
setline({lnum}, {line}) Number set line {lnum} to {line}
|
setline({lnum}, {line}) Number set line {lnum} to {line}
|
||||||
@ -1640,6 +1640,84 @@ diff_hlID({lnum}, {col}) *diff_hlID()*
|
|||||||
|
|
||||||
Can also be used as a |method|: >
|
Can also be used as a |method|: >
|
||||||
GetLnum()->diff_hlID(col)
|
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.
|
||||||
|
|
||||||
|
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()
|
||||||
|
<
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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()
|
||||||
|
<
|
||||||
|
|
||||||
|
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('あ')
|
||||||
|
<
|
||||||
|
|
||||||
|
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()
|
||||||
|
<
|
||||||
|
|
||||||
empty({expr}) *empty()*
|
empty({expr}) *empty()*
|
||||||
Return the Number 1 if {expr} is empty, zero otherwise.
|
Return the Number 1 if {expr} is empty, zero otherwise.
|
||||||
@ -2895,45 +2973,6 @@ getcwd([{winnr} [, {tabnr}]]) *getcwd()*
|
|||||||
|
|
||||||
Can also be used as a |method|: >
|
Can also be used as a |method|: >
|
||||||
GetWinnr()->getcwd()
|
GetWinnr()->getcwd()
|
||||||
<
|
|
||||||
|
|
||||||
getdigraph({chars}) *getdigraph()* *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.
|
|
||||||
|
|
||||||
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()
|
|
||||||
<
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
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()
|
|
||||||
<
|
|
||||||
|
|
||||||
getenv({name}) *getenv()*
|
getenv({name}) *getenv()*
|
||||||
Return the value of environment variable {name}. The {name}
|
Return the value of environment variable {name}. The {name}
|
||||||
@ -6777,46 +6816,6 @@ setcursorcharpos({list})
|
|||||||
Can also be used as a |method|: >
|
Can also be used as a |method|: >
|
||||||
GetCursorPos()->setcursorcharpos()
|
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('あ')
|
|
||||||
<
|
|
||||||
|
|
||||||
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()
|
|
||||||
<
|
|
||||||
|
|
||||||
setenv({name}, {val}) *setenv()*
|
setenv({name}, {val}) *setenv()*
|
||||||
Set environment variable {name} to {val}. Example: >
|
Set environment variable {name} to {val}. Example: >
|
||||||
call setenv('HOME', '/home/myhome')
|
call setenv('HOME', '/home/myhome')
|
||||||
|
@ -37,7 +37,7 @@ An alternative is using the 'keymap' option.
|
|||||||
future.
|
future.
|
||||||
NOTE: This command cannot add a digraph that starts
|
NOTE: This command cannot add a digraph that starts
|
||||||
with a white space. If you want to add such digraph,
|
with a white space. If you want to add such digraph,
|
||||||
you can use |setdigraph()| instead.
|
you can use |digraph_set()| instead.
|
||||||
|
|
||||||
Example of the output of ":digraphs": >
|
Example of the output of ":digraphs": >
|
||||||
TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228
|
TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228
|
||||||
|
@ -960,14 +960,14 @@ Window size and position: *window-size-functions*
|
|||||||
winrestview() restore saved view of current window
|
winrestview() restore saved view of current window
|
||||||
|
|
||||||
Mappings: *mapping-functions*
|
Mappings: *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
|
hasmapto() check if a mapping exists
|
||||||
mapcheck() check if a matching mapping exists
|
mapcheck() check if a matching mapping exists
|
||||||
maparg() get rhs of a mapping
|
maparg() get rhs of a mapping
|
||||||
wildmenumode() check if the wildmode is active
|
wildmenumode() check if the wildmode is active
|
||||||
getdigraph() get |digraph|
|
|
||||||
getdigraphlist() get all |digraph|s
|
|
||||||
setdigraph() register |digraph|
|
|
||||||
setdigraphlist() register multiple |digraph|s
|
|
||||||
|
|
||||||
Signs: *sign-functions*
|
Signs: *sign-functions*
|
||||||
sign_define() define or update a sign
|
sign_define() define or update a sign
|
||||||
|
@ -39,8 +39,8 @@ static char e_digraph_must_be_just_two_characters_str[]
|
|||||||
= N_("E1214: Digraph must be just two characters: %s");
|
= N_("E1214: Digraph must be just two characters: %s");
|
||||||
static char e_digraph_argument_must_be_one_character_str[]
|
static char e_digraph_argument_must_be_one_character_str[]
|
||||||
= N_("E1215: Digraph must be one character: %s");
|
= N_("E1215: Digraph must be one character: %s");
|
||||||
static char e_setdigraphlist_argument_must_be_list_of_lists_with_two_items[]
|
static char e_digraph_setlist_argument_must_be_list_of_lists_with_two_items[]
|
||||||
= N_("E1216: setdigraphlist() argument must be a list of lists with two items");
|
= N_("E1216: digraph_setlist() argument must be a list of lists with two items");
|
||||||
|
|
||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "digraph.c.generated.h"
|
# include "digraph.c.generated.h"
|
||||||
@ -1465,7 +1465,7 @@ int do_digraph(int c)
|
|||||||
backspaced = -1;
|
backspaced = -1;
|
||||||
} else if (p_dg) {
|
} else if (p_dg) {
|
||||||
if (backspaced >= 0) {
|
if (backspaced >= 0) {
|
||||||
c = getdigraph(backspaced, c, false);
|
c = digraph_get(backspaced, c, false);
|
||||||
}
|
}
|
||||||
backspaced = -1;
|
backspaced = -1;
|
||||||
|
|
||||||
@ -1537,7 +1537,7 @@ int get_digraph(bool cmdline)
|
|||||||
|
|
||||||
if (cc != ESC) {
|
if (cc != ESC) {
|
||||||
// ESC cancels CTRL-K
|
// ESC cancels CTRL-K
|
||||||
return getdigraph(c, cc, true);
|
return digraph_get(c, cc, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NUL;
|
return NUL;
|
||||||
@ -1601,7 +1601,7 @@ static int getexactdigraph(int char1, int char2, bool meta_char)
|
|||||||
/// @param meta_char
|
/// @param meta_char
|
||||||
///
|
///
|
||||||
/// @return The digraph.
|
/// @return The digraph.
|
||||||
int getdigraph(int char1, int char2, bool meta_char)
|
int digraph_get(int char1, int char2, bool meta_char)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
@ -1729,7 +1729,7 @@ void listdigraphs(bool use_headers)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getdigraphlist_appendpair(digr_T *dp, list_T *l)
|
static void digraph_getlist_appendpair(digr_T *dp, list_T *l)
|
||||||
{
|
{
|
||||||
list_T *l2 = tv_list_alloc(2);
|
list_T *l2 = tv_list_alloc(2);
|
||||||
tv_list_append_list(l, l2);
|
tv_list_append_list(l, l2);
|
||||||
@ -1746,7 +1746,7 @@ static void getdigraphlist_appendpair(digr_T *dp, list_T *l)
|
|||||||
tv_list_append_string(l2, (char *)buf, -1);
|
tv_list_append_string(l2, (char *)buf, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void getdigraphlist_common(bool list_all, typval_T *rettv)
|
void digraph_getlist_common(bool list_all, typval_T *rettv)
|
||||||
{
|
{
|
||||||
tv_list_alloc_ret(rettv, (int)sizeof(digraphdefault) + user_digraphs.ga_len);
|
tv_list_alloc_ret(rettv, (int)sizeof(digraphdefault) + user_digraphs.ga_len);
|
||||||
|
|
||||||
@ -1760,7 +1760,7 @@ void getdigraphlist_common(bool list_all, typval_T *rettv)
|
|||||||
tmp.char2 = dp->char2;
|
tmp.char2 = dp->char2;
|
||||||
tmp.result = getexactdigraph(tmp.char1, tmp.char2, false);
|
tmp.result = getexactdigraph(tmp.char1, tmp.char2, false);
|
||||||
if (tmp.result != 0 && tmp.result != tmp.char2) {
|
if (tmp.result != 0 && tmp.result != tmp.char2) {
|
||||||
getdigraphlist_appendpair(&tmp, rettv->vval.v_list);
|
digraph_getlist_appendpair(&tmp, rettv->vval.v_list);
|
||||||
}
|
}
|
||||||
dp++;
|
dp++;
|
||||||
}
|
}
|
||||||
@ -1768,7 +1768,7 @@ void getdigraphlist_common(bool list_all, typval_T *rettv)
|
|||||||
|
|
||||||
dp = (digr_T *)user_digraphs.ga_data;
|
dp = (digr_T *)user_digraphs.ga_data;
|
||||||
for (int i = 0; i < user_digraphs.ga_len && !got_int; i++) {
|
for (int 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++;
|
dp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1889,7 +1889,7 @@ static int get_digraph_chars(typval_T *arg, int *char1, int *char2)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool setdigraph_common(typval_T *argchars, typval_T *argdigraph)
|
static bool digraph_set_common(typval_T *argchars, typval_T *argdigraph)
|
||||||
{
|
{
|
||||||
int char1, char2;
|
int char1, char2;
|
||||||
if (get_digraph_chars(argchars, &char1, &char2) == FAIL) {
|
if (get_digraph_chars(argchars, &char1, &char2) == FAIL) {
|
||||||
@ -1912,8 +1912,8 @@ static bool setdigraph_common(typval_T *argchars, typval_T *argdigraph)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "getdigraph()" function
|
/// "digraph_get()" function
|
||||||
void f_getdigraph(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
void f_digraph_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||||
{
|
{
|
||||||
rettv->v_type = VAR_STRING;
|
rettv->v_type = VAR_STRING;
|
||||||
rettv->vval.v_string = NULL; // Return empty string for failure
|
rettv->vval.v_string = NULL; // Return empty string for failure
|
||||||
@ -1926,15 +1926,15 @@ void f_getdigraph(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
semsg(_(e_digraph_must_be_just_two_characters_str), digraphs);
|
semsg(_(e_digraph_must_be_just_two_characters_str), digraphs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int code = getdigraph(digraphs[0], digraphs[1], false);
|
int code = digraph_get(digraphs[0], digraphs[1], false);
|
||||||
|
|
||||||
char_u buf[NUMBUFLEN];
|
char_u buf[NUMBUFLEN];
|
||||||
buf[utf_char2bytes(code, buf)] = NUL;
|
buf[utf_char2bytes(code, buf)] = NUL;
|
||||||
rettv->vval.v_string = vim_strsave(buf);
|
rettv->vval.v_string = vim_strsave(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "getdigraphlist()" function
|
/// "digraph_getlist()" function
|
||||||
void f_getdigraphlist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
void f_digraph_getlist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||||
{
|
{
|
||||||
bool flag_list_all;
|
bool flag_list_all;
|
||||||
|
|
||||||
@ -1949,30 +1949,30 @@ void f_getdigraphlist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
flag_list_all = flag != 0;
|
flag_list_all = flag != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
getdigraphlist_common(flag_list_all, rettv);
|
digraph_getlist_common(flag_list_all, rettv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "setdigraph()" function
|
/// "digraph_set()" function
|
||||||
void f_setdigraph(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
void f_digraph_set(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||||
{
|
{
|
||||||
rettv->v_type = VAR_BOOL;
|
rettv->v_type = VAR_BOOL;
|
||||||
rettv->vval.v_bool = kBoolVarFalse;
|
rettv->vval.v_bool = kBoolVarFalse;
|
||||||
|
|
||||||
if (!setdigraph_common(&argvars[0], &argvars[1])) {
|
if (!digraph_set_common(&argvars[0], &argvars[1])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rettv->vval.v_bool = kBoolVarTrue;
|
rettv->vval.v_bool = kBoolVarTrue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "setdigraphlist()" function
|
/// "digraph_setlist()" function
|
||||||
void f_setdigraphlist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
void f_digraph_setlist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||||
{
|
{
|
||||||
rettv->v_type = VAR_BOOL;
|
rettv->v_type = VAR_BOOL;
|
||||||
rettv->vval.v_bool = kBoolVarFalse;
|
rettv->vval.v_bool = kBoolVarFalse;
|
||||||
|
|
||||||
if (argvars[0].v_type != VAR_LIST) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1985,18 +1985,18 @@ void f_setdigraphlist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
|||||||
|
|
||||||
TV_LIST_ITER_CONST(pl, pli, {
|
TV_LIST_ITER_CONST(pl, pli, {
|
||||||
if (TV_LIST_ITEM_TV(pli)->v_type != VAR_LIST) {
|
if (TV_LIST_ITEM_TV(pli)->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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_T *l = TV_LIST_ITEM_TV(pli)->vval.v_list;
|
list_T *l = TV_LIST_ITEM_TV(pli)->vval.v_list;
|
||||||
if (l == NULL || tv_list_len(l) != 2) {
|
if (l == NULL || tv_list_len(l) != 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!setdigraph_common(TV_LIST_ITEM_TV(tv_list_first(l)),
|
if (!digraph_set_common(TV_LIST_ITEM_TV(tv_list_first(l)),
|
||||||
TV_LIST_ITEM_TV(TV_LIST_ITEM_NEXT(l, tv_list_first(l))))) {
|
TV_LIST_ITEM_TV(TV_LIST_ITEM_NEXT(l, tv_list_first(l))))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -9260,7 +9260,7 @@ static int ins_digraph(void)
|
|||||||
}
|
}
|
||||||
if (cc != ESC) {
|
if (cc != ESC) {
|
||||||
AppendToRedobuff(CTRL_V_STR);
|
AppendToRedobuff(CTRL_V_STR);
|
||||||
c = getdigraph(c, cc, true);
|
c = digraph_get(c, cc, true);
|
||||||
clear_showcmd();
|
clear_showcmd();
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,10 @@ return {
|
|||||||
did_filetype={},
|
did_filetype={},
|
||||||
diff_filler={args=1, base=1},
|
diff_filler={args=1, base=1},
|
||||||
diff_hlID={args=2, base=1},
|
diff_hlID={args=2, base=1},
|
||||||
|
digraph_get={args=1, base=1},
|
||||||
|
digraph_getlist={args={0, 1}, base=1},
|
||||||
|
digraph_set={args=2, base=1},
|
||||||
|
digraph_setlist={args=1, base=1},
|
||||||
empty={args=1, base=1},
|
empty={args=1, base=1},
|
||||||
environ={},
|
environ={},
|
||||||
escape={args=2, base=1},
|
escape={args=2, base=1},
|
||||||
@ -156,8 +160,6 @@ return {
|
|||||||
getcurpos={args={0, 1}, base=1},
|
getcurpos={args={0, 1}, base=1},
|
||||||
getcursorcharpos={args={0, 1}, base=1},
|
getcursorcharpos={args={0, 1}, base=1},
|
||||||
getcwd={args={0, 2}, base=1},
|
getcwd={args={0, 2}, base=1},
|
||||||
getdigraph={args=1, base=1},
|
|
||||||
getdigraphlist={args={0, 1}, base=1},
|
|
||||||
getenv={args=1, base=1},
|
getenv={args=1, base=1},
|
||||||
getfontname={args={0, 1}},
|
getfontname={args={0, 1}},
|
||||||
getfperm={args=1, base=1},
|
getfperm={args=1, base=1},
|
||||||
@ -324,8 +326,6 @@ return {
|
|||||||
setcharsearch={args=1, base=1},
|
setcharsearch={args=1, base=1},
|
||||||
setcmdpos={args=1, base=1},
|
setcmdpos={args=1, base=1},
|
||||||
setcursorcharpos={args={1, 3}, base=1},
|
setcursorcharpos={args={1, 3}, base=1},
|
||||||
setdigraph={args=2, base=1},
|
|
||||||
setdigraphlist={args=1, base=1},
|
|
||||||
setenv={args=2, base=2},
|
setenv={args=2, base=2},
|
||||||
setfperm={args=2, base=1},
|
setfperm={args=2, base=1},
|
||||||
setline={args=2, base=2},
|
setline={args=2, base=2},
|
||||||
|
@ -505,47 +505,47 @@ func Test_entering_digraph()
|
|||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_setdigraph_function()
|
func Test_digraph_set_function()
|
||||||
new
|
new
|
||||||
call setdigraph('aa', 'あ')
|
call digraph_set('aa', 'あ')
|
||||||
call Put_Dig('aa')
|
call Put_Dig('aa')
|
||||||
call assert_equal('あ', getline('$'))
|
call assert_equal('あ', getline('$'))
|
||||||
call setdigraph(' i', 'い')
|
call digraph_set(' i', 'い')
|
||||||
call Put_Dig(' i')
|
call Put_Dig(' i')
|
||||||
call assert_equal('い', getline('$'))
|
call assert_equal('い', getline('$'))
|
||||||
call setdigraph(' ', 'う')
|
call digraph_set(' ', 'う')
|
||||||
call Put_Dig(' ')
|
call Put_Dig(' ')
|
||||||
call assert_equal('う', getline('$'))
|
call assert_equal('う', getline('$'))
|
||||||
|
|
||||||
eval 'aa'->setdigraph('え')
|
eval 'aa'->digraph_set('え')
|
||||||
call Put_Dig('aa')
|
call Put_Dig('aa')
|
||||||
call assert_equal('え', getline('$'))
|
call assert_equal('え', getline('$'))
|
||||||
|
|
||||||
call assert_fails('call setdigraph("aaa", "あ")', 'E1214: Digraph must be just two characters: aaa')
|
call assert_fails('call digraph_set("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 digraph_set("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 digraph_set("あ", "あ")', 'E1214: Digraph must be just two characters: あ')
|
||||||
call assert_fails('call setdigraph("aa", "ああ")', 'E1215: Digraph must be one character: ああ')
|
call assert_fails('call digraph_set("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("aa", "か" .. nr2char(0x3099))', 'E1215: Digraph must be one character: か' .. nr2char(0x3099))
|
||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_getdigraph_function()
|
func Test_digraph_get_function()
|
||||||
" Built-in digraphs
|
" Built-in digraphs
|
||||||
call assert_equal('∞', getdigraph('00'))
|
call assert_equal('∞', digraph_get('00'))
|
||||||
|
|
||||||
" User-defined digraphs
|
" User-defined digraphs
|
||||||
call setdigraph('aa', 'あ')
|
call digraph_set('aa', 'あ')
|
||||||
call setdigraph(' i', 'い')
|
call digraph_set(' i', 'い')
|
||||||
call setdigraph(' ', 'う')
|
call digraph_set(' ', 'う')
|
||||||
call assert_equal('あ', getdigraph('aa'))
|
call assert_equal('あ', digraph_get('aa'))
|
||||||
call assert_equal('あ', 'aa'->getdigraph())
|
call assert_equal('あ', 'aa'->digraph_get())
|
||||||
call assert_equal('い', getdigraph(' i'))
|
call assert_equal('い', digraph_get(' i'))
|
||||||
call assert_equal('う', getdigraph(' '))
|
call assert_equal('う', digraph_get(' '))
|
||||||
call assert_fails('call getdigraph("aaa")', 'E1214: Digraph must be just two characters: aaa')
|
call assert_fails('call digraph_get("aaa")', 'E1214: Digraph must be just two characters: aaa')
|
||||||
call assert_fails('call getdigraph("b")', 'E1214: Digraph must be just two characters: b')
|
call assert_fails('call digraph_get("b")', 'E1214: Digraph must be just two characters: b')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_getdigraph_function_encode()
|
func Test_digraph_get_function_encode()
|
||||||
throw 'Skipped: Nvim does not support setting encoding=japan'
|
throw 'Skipped: Nvim does not support setting encoding=japan'
|
||||||
CheckFeature iconv
|
CheckFeature iconv
|
||||||
let testcases = {
|
let testcases = {
|
||||||
@ -553,34 +553,34 @@ func Test_getdigraph_function_encode()
|
|||||||
\'aa': 'あ',
|
\'aa': 'あ',
|
||||||
\}
|
\}
|
||||||
for [key, ch] in items(testcases)
|
for [key, ch] in items(testcases)
|
||||||
call setdigraph(key, ch)
|
call digraph_set(key, ch)
|
||||||
set encoding=japan
|
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&
|
set encoding&
|
||||||
endfor
|
endfor
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_setdigraphlist_function()
|
func Test_digraph_setlist_function()
|
||||||
call setdigraphlist([['aa', 'き'], ['bb', 'く']])
|
call digraph_setlist([['aa', 'き'], ['bb', 'く']])
|
||||||
call assert_equal('き', getdigraph('aa'))
|
call assert_equal('き', digraph_get('aa'))
|
||||||
call assert_equal('く', getdigraph('bb'))
|
call assert_equal('く', digraph_get('bb'))
|
||||||
|
|
||||||
call assert_fails('call setdigraphlist([[]])', 'E1216:')
|
call assert_fails('call digraph_setlist([[]])', 'E1216:')
|
||||||
call assert_fails('call setdigraphlist([["aa", "b", "cc"]])', '1216:')
|
call assert_fails('call digraph_setlist([["aa", "b", "cc"]])', '1216:')
|
||||||
call assert_fails('call setdigraphlist([["あ", "あ"]])', 'E1214: Digraph must be just two characters: あ')
|
call assert_fails('call digraph_setlist([["あ", "あ"]])', 'E1214: Digraph must be just two characters: あ')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_getdigraphlist_function()
|
func Test_digraph_getlist_function()
|
||||||
" Make sure user-defined digraphs are defined
|
" Make sure user-defined digraphs are defined
|
||||||
call setdigraphlist([['aa', 'き'], ['bb', 'く']])
|
call digraph_setlist([['aa', 'き'], ['bb', 'く']])
|
||||||
|
|
||||||
for pair in getdigraphlist(1)
|
for pair in digraph_getlist(1)
|
||||||
call assert_equal(getdigraph(pair[0]), pair[1])
|
call assert_equal(digraph_get(pair[0]), pair[1])
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" We don't know how many digraphs are registered before, so check the number
|
" We don't know how many digraphs are registered before, so check the number
|
||||||
" of digraphs returned.
|
" of digraphs returned.
|
||||||
call assert_equal(getdigraphlist()->len(), getdigraphlist(0)->len())
|
call assert_equal(digraph_getlist()->len(), digraph_getlist(0)->len())
|
||||||
call assert_notequal((getdigraphlist()->len()), getdigraphlist(1)->len())
|
call assert_notequal((digraph_getlist()->len()), digraph_getlist(1)->len())
|
||||||
endfunc
|
endfunc
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Loading…
Reference in New Issue
Block a user