/// Get a digraph. Used after typing CTRL-K on the command line or in normal /// mode. /// /// @param cmdline TRUE when called from the cmdline /// /// @returns composed character, or NUL when ESC was used. int get_digraph(int cmdline) { int cc; no_mapping++; int c = plain_vgetc(); no_mapping--; if (c != ESC) { // ESC cancels CTRL-K if (IS_SPECIAL(c)) { // insert special key code return c; } if (cmdline) { if ((char2cells(c) == 1) && (cmdline_star == 0)) { putcmdline(c, TRUE); } } else { add_to_showcmd(c); } no_mapping++; cc = plain_vgetc(); no_mapping--; if (cc != ESC) { // ESC cancels CTRL-K return getdigraph(c, cc, TRUE); } } return NUL; }
static void printdigraph(digr_T *dp) { char_u buf[30]; char_u *p; int list_width; if ((dy_flags & DY_UHEX) || has_mbyte) { list_width = 13; } else { list_width = 11; } if (dp->result != 0) { if (msg_col > Columns - list_width) { msg_putchar('\n'); } if (msg_col) { while (msg_col % list_width != 0) { msg_putchar(' '); } } p = buf; *p++ = dp->char1; *p++ = dp->char2; *p++ = ' '; if (has_mbyte) { // add a space to draw a composing char on if (enc_utf8 && utf_iscomposing(dp->result)) { *p++ = ' '; } p += (*mb_char2bytes)(dp->result, p); } else { *p++ = (char_u)dp->result; } if (char2cells(dp->result) == 1) { *p++ = ' '; } assert(p >= buf); vim_snprintf((char *)p, sizeof(buf) - (size_t)(p - buf), " %3d", dp->result); msg_outtrans(buf); } }
static void printdigraph(digr_T *dp) { char_u buf[30]; char_u *p; int list_width; list_width = 13; if (dp->result != 0) { if (msg_col > Columns - list_width) { msg_putchar('\n'); } // Make msg_col a multiple of list_width by using spaces. if (msg_col % list_width != 0) { int spaces = (msg_col / list_width + 1) * list_width - msg_col; while (spaces--) { msg_putchar(' '); } } p = buf; *p++ = dp->char1; *p++ = dp->char2; *p++ = ' '; // add a space to draw a composing char on if (utf_iscomposing(dp->result)) { *p++ = ' '; } p += (*mb_char2bytes)(dp->result, p); if (char2cells(dp->result) == 1) { *p++ = ' '; } assert(p >= buf); vim_snprintf((char *)p, sizeof(buf) - (size_t)(p - buf), " %3d", dp->result); msg_outtrans(buf); } }