Mercurial > vim
diff src/digraph.c @ 13359:81c348d40312 v8.0.1553
patch 8.0.1553: cannot see what digraph is used to insert a character
commit https://github.com/vim/vim/commit/5f73ef8d20070cd45c9aea4dc33c2e0657f5515c
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 27 21:09:30 2018 +0100
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 27 Feb 2018 21:15:06 +0100 |
parents | 3321582cae78 |
children | 8a9a00357676 |
line wrap: on
line diff
--- 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.