Example #1
0
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);
  }
}
Example #2
0
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);
  }
}