Ejemplo n.º 1
0
Archivo: mark.c Proyecto: ZyX-I/neovim
/*
 * print the changelist
 */
void ex_changes(exarg_T *eap)
{
  int i;
  char_u      *name;

  // Highlight title
  MSG_PUTS_TITLE(_("\nchange line  col text"));

  for (i = 0; i < curbuf->b_changelistlen && !got_int; ++i) {
    if (curbuf->b_changelist[i].mark.lnum != 0) {
      msg_putchar('\n');
      if (got_int)
        break;
      sprintf((char *)IObuff, "%c %3d %5ld %4d ",
          i == curwin->w_changelistidx ? '>' : ' ',
          i > curwin->w_changelistidx ? i - curwin->w_changelistidx
          : curwin->w_changelistidx - i,
          (long)curbuf->b_changelist[i].mark.lnum,
          curbuf->b_changelist[i].mark.col);
      msg_outtrans(IObuff);
      name = mark_line(&curbuf->b_changelist[i].mark, 17);
      msg_outtrans_attr(name, HL_ATTR(HLF_D));
      xfree(name);
      os_breakcheck();
    }
    ui_flush();
  }
  if (curwin->w_changelistidx == curbuf->b_changelistlen)
    MSG_PUTS("\n>");
}
Ejemplo n.º 2
0
Archivo: mark.c Proyecto: ZyX-I/neovim
static void
show_one_mark(
    int c,
    char_u *arg,
    pos_T *p,
    char_u *name,
    int current                    /* in current file */
)
{
  static int did_title = FALSE;
  int mustfree = FALSE;

  if (c == -1) {                            /* finish up */
    if (did_title)
      did_title = FALSE;
    else {
      if (arg == NULL)
        MSG(_("No marks set"));
      else
        EMSG2(_("E283: No marks matching \"%s\""), arg);
    }
  }
  /* don't output anything if 'q' typed at --more-- prompt */
  else if (!got_int
           && (arg == NULL || vim_strchr(arg, c) != NULL)
           && p->lnum != 0) {
    if (!did_title) {
      /* Highlight title */
      MSG_PUTS_TITLE(_("\nmark line  col file/text"));
      did_title = TRUE;
    }
    msg_putchar('\n');
    if (!got_int) {
      sprintf((char *)IObuff, " %c %6ld %4d ", c, p->lnum, p->col);
      msg_outtrans(IObuff);
      if (name == NULL && current) {
        name = mark_line(p, 15);
        mustfree = TRUE;
      }
      if (name != NULL) {
        msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0);
        if (mustfree) {
          xfree(name);
        }
      }
    }
    ui_flush();                    /* show one line at a time */
  }
}
Ejemplo n.º 3
0
Archivo: sign.c Proyecto: Snaptags/vim
/*
 * List placed signs for "rbuf".  If "rbuf" is NULL do it for all buffers.
 */
    static void
sign_list_placed(buf_T *rbuf, char_u *sign_group)
{
    buf_T	*buf;
    signlist_T	*sign;
    char	lbuf[MSG_BUF_LEN];
    char	group[MSG_BUF_LEN];

    msg_puts_title(_("\n--- Signs ---"));
    msg_putchar('\n');
    if (rbuf == NULL)
	buf = firstbuf;
    else
	buf = rbuf;
    while (buf != NULL && !got_int)
    {
	if (buf->b_signlist != NULL)
	{
	    vim_snprintf(lbuf, MSG_BUF_LEN, _("Signs for %s:"), buf->b_fname);
	    msg_puts_attr(lbuf, HL_ATTR(HLF_D));
	    msg_putchar('\n');
	}
	FOR_ALL_SIGNS_IN_BUF(buf, sign)
	{
	    if (got_int)
		break;
	    if (!sign_in_group(sign, sign_group))
		continue;
	    if (sign->group != NULL)
		vim_snprintf(group, MSG_BUF_LEN, _("  group=%s"),
							sign->group->sg_name);
	    else
		group[0] = '\0';
	    vim_snprintf(lbuf, MSG_BUF_LEN,
			   _("    line=%ld  id=%d%s  name=%s  priority=%d"),
			   (long)sign->lnum, sign->id, group,
			   sign_typenr2name(sign->typenr), sign->priority);
	    msg_puts(lbuf);
	    msg_putchar('\n');
	}
	if (rbuf != NULL)
	    break;
	buf = buf->b_next;
    }
}
Ejemplo n.º 4
0
Archivo: farsi.c Proyecto: SLieng/nvm
/// Convert the Farsi VIM into Farsi 3342 standard.
static void conv_to_pstd(void)
{
  char_u *ptr;
  int lnum, llen, i;

  // Following line contains Farsi encoded character.
  do_cmdline_cmd("%s/\232/\202\231/ge");
  for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; lnum++) {
    ptr = ml_get((linenr_T)lnum);
    llen = (int)STRLEN(ptr);
    for (i = 0; i < llen; i++) {
      ptr[i] = toF_TyA(ptr[i]);
    }
  }

  // Assume the screen has been messed up: clear it and redraw.
  redraw_later(CLEAR);
  msg_attr((const char *)farsi_text_2, HL_ATTR(HLF_S));
}
Ejemplo n.º 5
0
Archivo: mark.c Proyecto: ZyX-I/neovim
/*
 * print the jumplist
 */
void ex_jumps(exarg_T *eap)
{
  int i;
  char_u      *name;

  cleanup_jumplist();
  /* Highlight title */
  MSG_PUTS_TITLE(_("\n jump line  col file/text"));
  for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) {
    if (curwin->w_jumplist[i].fmark.mark.lnum != 0) {
      if (curwin->w_jumplist[i].fmark.fnum == 0)
        fname2fnum(&curwin->w_jumplist[i]);
      name = fm_getname(&curwin->w_jumplist[i].fmark, 16);
      if (name == NULL)             /* file name not available */
        continue;

      msg_putchar('\n');
      if (got_int) {
        xfree(name);
        break;
      }
      sprintf((char *)IObuff, "%c %2d %5ld %4d ",
          i == curwin->w_jumplistidx ? '>' : ' ',
          i > curwin->w_jumplistidx ? i - curwin->w_jumplistidx
          : curwin->w_jumplistidx - i,
          curwin->w_jumplist[i].fmark.mark.lnum,
          curwin->w_jumplist[i].fmark.mark.col);
      msg_outtrans(IObuff);
      msg_outtrans_attr(name,
                        curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum
                        ? HL_ATTR(HLF_D) : 0);
      xfree(name);
      os_breakcheck();
    }
    ui_flush();
  }
  if (curwin->w_jumplistidx == curwin->w_jumplistlen)
    MSG_PUTS("\n>");
}
Ejemplo n.º 6
0
Archivo: farsi.c Proyecto: SLieng/nvm
/// Convert the Farsi 3342 standard into Farsi VIM.
static void conv_to_pvim(void)
{
  char_u *ptr;
  int lnum, llen, i;

  for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) {
    ptr = ml_get((linenr_T)lnum);
    llen = (int)STRLEN(ptr);
    for (i = 0; i < llen - 1; i++) {
      if (canF_Ljoin(ptr[i]) && canF_Rjoin(ptr[i + 1])) {
        ptr[i] = toF_leading(ptr[i]);
        i++;

        while (canF_Rjoin(ptr[i]) && i < llen) {
          ptr[i] = toF_Rjoin(ptr[i]);
          if (F_isterm(ptr[i]) || !F_isalpha(ptr[i])) {
            break;
          }
          i++;
        }

        if (!F_isalpha(ptr[i]) || !canF_Rjoin(ptr[i])) {
          ptr[i - 1] = toF_ending(ptr[i - 1]);
        }
      } else {
        ptr[i] = toF_TyA(ptr[i]);
      }
    }
  }

  // Following lines contains Farsi encoded character.
  do_cmdline_cmd("%s/\202\231/\232/ge");
  do_cmdline_cmd("%s/\201\231/\370\334/ge");

  // Assume the screen has been messed up: clear it and redraw.
  redraw_later(CLEAR);
  MSG_ATTR((const char *)farsi_text_1, HL_ATTR(HLF_S));
}
Ejemplo n.º 7
0
    static void
do_intro_line(
    int		row,
    char_u	*mesg,
    int		add_version,
    int		attr)
{
    char_u	vers[20];
    int		col;
    char_u	*p;
    int		l;
    int		clen;
#ifdef MODIFIED_BY
# define MODBY_LEN 150
    char_u	modby[MODBY_LEN];

    if (*mesg == ' ')
    {
	vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1);
	l = (int)STRLEN(modby);
	vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1);
	mesg = modby;
    }
#endif

    /* Center the message horizontally. */
    col = vim_strsize(mesg);
    if (add_version)
    {
	STRCPY(vers, mediumVersion);
	if (highest_patch())
	{
	    /* Check for 9.9x or 9.9xx, alpha/beta version */
	    if (isalpha((int)vers[3]))
	    {
		int len = (isalpha((int)vers[4])) ? 5 : 4;
		sprintf((char *)vers + len, ".%d%s", highest_patch(),
							 mediumVersion + len);
	    }
	    else
		sprintf((char *)vers + 3, ".%d", highest_patch());
	}
	col += (int)STRLEN(vers);
    }
    col = (Columns - col) / 2;
    if (col < 0)
	col = 0;

    /* Split up in parts to highlight <> items differently. */
    for (p = mesg; *p != NUL; p += l)
    {
	clen = 0;
	for (l = 0; p[l] != NUL
			 && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l)
	{
#ifdef FEAT_MBYTE
	    if (has_mbyte)
	    {
		clen += ptr2cells(p + l);
		l += (*mb_ptr2len)(p + l) - 1;
	    }
	    else
#endif
		clen += byte2cells(p[l]);
	}
	screen_puts_len(p, l, row, col, *p == '<' ? HL_ATTR(HLF_8) : attr);
	col += clen;
    }

    /* Add the version number to the version line. */
    if (add_version)
	screen_puts(vers, row, col, 0);
}