diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-02-27 21:09:30 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-02-27 21:09:30 +0100 |
commit | 5f73ef8d20070cd45c9aea4dc33c2e0657f5515c (patch) | |
tree | 4a223aa7d89da5c1d733287193626efee279155e /src/digraph.c | |
parent | 8195247054a659fe5cbc238197634d5e13e8e8e9 (diff) | |
download | vim-5f73ef8d20070cd45c9aea4dc33c2e0657f5515c.zip |
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)
Diffstat (limited to 'src/digraph.c')
-rw-r--r-- | src/digraph.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/digraph.c b/src/digraph.c index 2c7ba9f0c..6f9c46ff7 100644 --- a/src/digraph.c +++ b/src/digraph.c @@ -1975,6 +1975,41 @@ do_digraph(int 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. * Returns composed character, or NUL when ESC was used. |