Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
13358:0a3d1708d414 | 13359:81c348d40312 |
---|---|
1973 lastchar = c; | 1973 lastchar = c; |
1974 return c; | 1974 return c; |
1975 } | 1975 } |
1976 | 1976 |
1977 /* | 1977 /* |
1978 * Find a digraph for "val". If found return the string to display it. | |
1979 * If not found return NULL. | |
1980 */ | |
1981 char_u * | |
1982 get_digraph_for_char(val) | |
1983 int val; | |
1984 { | |
1985 int i; | |
1986 int use_defaults; | |
1987 digr_T *dp; | |
1988 static char_u r[3]; | |
1989 | |
1990 for (use_defaults = 0; use_defaults <= 1; use_defaults++) | |
1991 { | |
1992 if (use_defaults == 0) | |
1993 dp = (digr_T *)user_digraphs.ga_data; | |
1994 else | |
1995 dp = digraphdefault; | |
1996 for (i = 0; use_defaults ? dp->char1 != NUL | |
1997 : i < user_digraphs.ga_len; ++i) | |
1998 { | |
1999 if (dp->result == val) | |
2000 { | |
2001 r[0] = dp->char1; | |
2002 r[1] = dp->char2; | |
2003 r[2] = NUL; | |
2004 return r; | |
2005 } | |
2006 ++dp; | |
2007 } | |
2008 } | |
2009 return NULL; | |
2010 } | |
2011 | |
2012 /* | |
1978 * Get a digraph. Used after typing CTRL-K on the command line or in normal | 2013 * Get a digraph. Used after typing CTRL-K on the command line or in normal |
1979 * mode. | 2014 * mode. |
1980 * Returns composed character, or NUL when ESC was used. | 2015 * Returns composed character, or NUL when ESC was used. |
1981 */ | 2016 */ |
1982 int | 2017 int |