forked from aniani/vim
patch 8.0.1553: cannot see what digraph is used to insert a character
Problem: Cannot see what digraph is used to insert a character. Solution: Show the digraph with the "ga" command. (Christian Brabandt)
This commit is contained in:
@@ -1974,6 +1974,41 @@ do_digraph(int c)
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a digraph for "val". If found return the string to display it.
|
||||
* If not found return NULL.
|
||||
*/
|
||||
char_u *
|
||||
get_digraph_for_char(val)
|
||||
int val;
|
||||
{
|
||||
int i;
|
||||
int use_defaults;
|
||||
digr_T *dp;
|
||||
static char_u r[3];
|
||||
|
||||
for (use_defaults = 0; use_defaults <= 1; use_defaults++)
|
||||
{
|
||||
if (use_defaults == 0)
|
||||
dp = (digr_T *)user_digraphs.ga_data;
|
||||
else
|
||||
dp = digraphdefault;
|
||||
for (i = 0; use_defaults ? dp->char1 != NUL
|
||||
: i < user_digraphs.ga_len; ++i)
|
||||
{
|
||||
if (dp->result == val)
|
||||
{
|
||||
r[0] = dp->char1;
|
||||
r[1] = dp->char2;
|
||||
r[2] = NUL;
|
||||
return r;
|
||||
}
|
||||
++dp;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a digraph. Used after typing CTRL-K on the command line or in normal
|
||||
* mode.
|
||||
|
Reference in New Issue
Block a user