mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 14:28:18 +00:00
vim-patch:8.0.1553: find digraph to insert a character #8190
Problem: Cannot see what digraph is used to insert a character.
Solution: Show the digraph with the "ga" command. (Christian Brabandt)
5f73ef8d20
close #8190
This commit is contained in:

committed by
Justin M. Keyes

parent
500345aea2
commit
3159cd4503
@@ -1397,7 +1397,7 @@ static digr_T digraphdefault[] =
|
||||
{ 'O', '`', 210 }, // <20>
|
||||
{ 'O', '^', 212 }, // <20>
|
||||
{ 'O', '~', 213 }, // <20>
|
||||
{ '/', '\\', 215 }, // <20> - multiplication symbol in ISO 8859-1
|
||||
{ '/', '\\', 215 }, // <20> - multiplication symbol in ISO 8859-1
|
||||
{ 'U', '`', 217 }, // <20>
|
||||
{ 'U', '^', 219 }, // <20>
|
||||
{ 'I', 'p', 222 }, // <20>
|
||||
@@ -1448,6 +1448,33 @@ int 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(int val)
|
||||
{
|
||||
digr_T *dp;
|
||||
static char_u r[3];
|
||||
|
||||
for (int use_defaults = 0; use_defaults <= 1; use_defaults++) {
|
||||
if (use_defaults == 0) {
|
||||
dp = (digr_T *)user_digraphs.ga_data;
|
||||
} else {
|
||||
dp = digraphdefault;
|
||||
}
|
||||
for (int 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