summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-02-27 21:09:30 +0100
committerBram Moolenaar <Bram@vim.org>2018-02-27 21:09:30 +0100
commit5f73ef8d20070cd45c9aea4dc33c2e0657f5515c (patch)
tree4a223aa7d89da5c1d733287193626efee279155e /src/ex_cmds.c
parent8195247054a659fe5cbc238197634d5e13e8e8e9 (diff)
patch 8.0.1553: cannot see what digraph is used to insert a characterv8.0.1553
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/ex_cmds.c')
-rw-r--r--src/ex_cmds.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index e05215a596..5b8e2d5226 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -49,6 +49,9 @@ do_ascii(exarg_T *eap UNUSED)
char buf1[20];
char buf2[20];
char_u buf3[7];
+#ifdef FEAT_DIGRAPHS
+ char_u *dig;
+#endif
#ifdef FEAT_MBYTE
int cc[MAX_MCO];
int ci = 0;
@@ -94,7 +97,15 @@ do_ascii(exarg_T *eap UNUSED)
else
#endif
buf2[0] = NUL;
- vim_snprintf((char *)IObuff, IOSIZE,
+#ifdef FEAT_DIGRAPHS
+ dig = get_digraph_for_char(cval);
+ if (dig != NULL)
+ vim_snprintf((char *)IObuff, IOSIZE,
+ _("<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s"),
+ transchar(c), buf1, buf2, cval, cval, cval, dig);
+ else
+#endif
+ vim_snprintf((char *)IObuff, IOSIZE,
_("<%s>%s%s %d, Hex %02x, Octal %03o"),
transchar(c), buf1, buf2, cval, cval, cval);
#ifdef FEAT_MBYTE
@@ -121,9 +132,19 @@ do_ascii(exarg_T *eap UNUSED)
)
IObuff[len++] = ' '; /* draw composing char on top of a space */
len += (*mb_char2bytes)(c, IObuff + len);
- vim_snprintf((char *)IObuff + len, IOSIZE - len,
- c < 0x10000 ? _("> %d, Hex %04x, Octal %o")
- : _("> %d, Hex %08x, Octal %o"), c, c, c);
+#ifdef FEAT_DIGRAPHS
+ dig = get_digraph_for_char(c);
+ if (dig != NULL)
+ vim_snprintf((char *)IObuff + len, IOSIZE - len,
+ c < 0x10000 ? _("> %d, Hex %04x, Oct %o, Digr %s")
+ : _("> %d, Hex %08x, Oct %o, Digr %s"),
+ c, c, c, dig);
+ else
+#endif
+ vim_snprintf((char *)IObuff + len, IOSIZE - len,
+ c < 0x10000 ? _("> %d, Hex %04x, Octal %o")
+ : _("> %d, Hex %08x, Octal %o"),
+ c, c, c);
if (ci == MAX_MCO)
break;
if (enc_utf8)