diff options
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; } |