aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/digraph.c
diff options
context:
space:
mode:
authorlokesh1197 <lokesh1197@gmail.com>2018-02-28 16:36:14 +0530
committerJustin M. Keyes <justinkz@gmail.com>2018-10-30 19:47:59 +0100
commit3159cd4503ae39301e010abe79c2d304437ee5c5 (patch)
treea9a05dceae909bacf268bfe8d9eb540c99b1af25 /src/nvim/digraph.c
parent500345aea2ef88b45e0905043ed435ad4676bcef (diff)
downloadrneovim-3159cd4503ae39301e010abe79c2d304437ee5c5.tar.gz
rneovim-3159cd4503ae39301e010abe79c2d304437ee5c5.tar.bz2
rneovim-3159cd4503ae39301e010abe79c2d304437ee5c5.zip
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) https://github.com/vim/vim/commit/5f73ef8d20070cd45c9aea4dc33c2e0657f5515c close #8190
Diffstat (limited to 'src/nvim/digraph.c')
-rw-r--r--src/nvim/digraph.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 5a491877a4..3329290634 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1397,7 +1397,7 @@ static digr_T digraphdefault[] =
{ 'O', '`', 210 }, // Ò
{ 'O', '^', 212 }, // Ô
{ 'O', '~', 213 }, // Õ
- { '/', '\\', 215 }, // × - multiplication symbol in ISO 8859-1
+ { '/', '\\', 215 }, // × - multiplication symbol in ISO 8859-1
{ 'U', '`', 217 }, // Ù
{ 'U', '^', 219 }, // Û
{ 'I', 'p', 222 }, // Þ
@@ -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.
///