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)
5f73ef8d20

close #8190
This commit is contained in:
lokesh1197
2018-02-28 16:36:14 +05:30
committed by Justin M. Keyes
parent 500345aea2
commit 3159cd4503
8 changed files with 131 additions and 58 deletions

View File

@@ -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;
}