comparison src/ex_cmds.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 b5806be0b36d
children 69517d67421f
comparison
equal deleted inserted replaced
13358:0a3d1708d414 13359:81c348d40312
47 int c; 47 int c;
48 int cval; 48 int cval;
49 char buf1[20]; 49 char buf1[20];
50 char buf2[20]; 50 char buf2[20];
51 char_u buf3[7]; 51 char_u buf3[7];
52 #ifdef FEAT_DIGRAPHS
53 char_u *dig;
54 #endif
52 #ifdef FEAT_MBYTE 55 #ifdef FEAT_MBYTE
53 int cc[MAX_MCO]; 56 int cc[MAX_MCO];
54 int ci = 0; 57 int ci = 0;
55 int len; 58 int len;
56 59
92 vim_snprintf(buf2, sizeof(buf2), " <M-%s>", 95 vim_snprintf(buf2, sizeof(buf2), " <M-%s>",
93 (char *)transchar(c & 0x7f)); 96 (char *)transchar(c & 0x7f));
94 else 97 else
95 #endif 98 #endif
96 buf2[0] = NUL; 99 buf2[0] = NUL;
97 vim_snprintf((char *)IObuff, IOSIZE, 100 #ifdef FEAT_DIGRAPHS
101 dig = get_digraph_for_char(cval);
102 if (dig != NULL)
103 vim_snprintf((char *)IObuff, IOSIZE,
104 _("<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s"),
105 transchar(c), buf1, buf2, cval, cval, cval, dig);
106 else
107 #endif
108 vim_snprintf((char *)IObuff, IOSIZE,
98 _("<%s>%s%s %d, Hex %02x, Octal %03o"), 109 _("<%s>%s%s %d, Hex %02x, Octal %03o"),
99 transchar(c), buf1, buf2, cval, cval, cval); 110 transchar(c), buf1, buf2, cval, cval, cval);
100 #ifdef FEAT_MBYTE 111 #ifdef FEAT_MBYTE
101 if (enc_utf8) 112 if (enc_utf8)
102 c = cc[ci++]; 113 c = cc[ci++];
119 && !gui.in_use 130 && !gui.in_use
120 # endif 131 # endif
121 ) 132 )
122 IObuff[len++] = ' '; /* draw composing char on top of a space */ 133 IObuff[len++] = ' '; /* draw composing char on top of a space */
123 len += (*mb_char2bytes)(c, IObuff + len); 134 len += (*mb_char2bytes)(c, IObuff + len);
124 vim_snprintf((char *)IObuff + len, IOSIZE - len, 135 #ifdef FEAT_DIGRAPHS
125 c < 0x10000 ? _("> %d, Hex %04x, Octal %o") 136 dig = get_digraph_for_char(c);
126 : _("> %d, Hex %08x, Octal %o"), c, c, c); 137 if (dig != NULL)
138 vim_snprintf((char *)IObuff + len, IOSIZE - len,
139 c < 0x10000 ? _("> %d, Hex %04x, Oct %o, Digr %s")
140 : _("> %d, Hex %08x, Oct %o, Digr %s"),
141 c, c, c, dig);
142 else
143 #endif
144 vim_snprintf((char *)IObuff + len, IOSIZE - len,
145 c < 0x10000 ? _("> %d, Hex %04x, Octal %o")
146 : _("> %d, Hex %08x, Octal %o"),
147 c, c, c);
127 if (ci == MAX_MCO) 148 if (ci == MAX_MCO)
128 break; 149 break;
129 if (enc_utf8) 150 if (enc_utf8)
130 c = cc[ci++]; 151 c = cc[ci++];
131 else 152 else