diff options
author | lokesh1197 <lokesh1197@gmail.com> | 2018-02-28 16:36:14 +0530 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-10-30 19:47:59 +0100 |
commit | 3159cd4503ae39301e010abe79c2d304437ee5c5 (patch) | |
tree | a9a05dceae909bacf268bfe8d9eb540c99b1af25 /src/nvim/ex_cmds.c | |
parent | 500345aea2ef88b45e0905043ed435ad4676bcef (diff) | |
download | rneovim-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/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 99f8963dad..dc942eb0b3 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -114,6 +114,7 @@ typedef struct { /// ":ascii" and "ga" implementation void do_ascii(const exarg_T *const eap) { + char_u *dig; int cc[MAX_MCO]; int c = utfc_ptr2char(get_cursor_pos_ptr(), cc); if (c == NUL) { @@ -141,10 +142,22 @@ void do_ascii(const exarg_T *const eap) } char buf2[20]; buf2[0] = NUL; - iobuff_len += ( - vim_snprintf((char *)IObuff + iobuff_len, sizeof(IObuff) - iobuff_len, - _("<%s>%s%s %d, Hex %02x, Octal %03o"), - transchar(c), buf1, buf2, cval, cval, cval)); + + dig = get_digraph_for_char(cval); + if (dig != NULL) { + iobuff_len += ( + vim_snprintf((char *)IObuff + iobuff_len, + sizeof(IObuff) - iobuff_len, + _("<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s"), + transchar(c), buf1, buf2, cval, cval, cval, dig)); + } else { + iobuff_len += ( + vim_snprintf((char *)IObuff + iobuff_len, + sizeof(IObuff) - iobuff_len, + _("<%s>%s%s %d, Hex %02x, Octal %03o"), + transchar(c), buf1, buf2, cval, cval, cval)); + } + c = cc[ci++]; } @@ -179,11 +192,25 @@ void do_ascii(const exarg_T *const eap) IObuff[iobuff_len++] = ' '; // Draw composing char on top of a space. } iobuff_len += utf_char2bytes(c, IObuff + iobuff_len); - iobuff_len += ( - vim_snprintf((char *)IObuff + iobuff_len, sizeof(IObuff) - iobuff_len, - (c < 0x10000 - ? _("> %d, Hex %04x, Octal %o") - : _("> %d, Hex %08x, Octal %o")), c, c, c)); + + dig = get_digraph_for_char(c); + if (dig != NULL) { + iobuff_len += ( + vim_snprintf((char *)IObuff + iobuff_len, + sizeof(IObuff) - iobuff_len, + (c < 0x10000 + ? _("> %d, Hex %04x, Oct %o, Digr %s") + : _("> %d, Hex %08x, Oct %o, Digr %s")), + c, c, c, dig)); + } else { + iobuff_len += ( + vim_snprintf((char *)IObuff + iobuff_len, + sizeof(IObuff) - iobuff_len, + (c < 0x10000 + ? _("> %d, Hex %04x, Octal %o") + : _("> %d, Hex %08x, Octal %o")), + c, c, c)); + } if (ci == MAX_MCO) { break; } |