예제 #1
0
파일: mark.c 프로젝트: Davie013/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].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].lnum,
          curbuf->b_changelist[i].col);
      msg_outtrans(IObuff);
      name = mark_line(&curbuf->b_changelist[i], 17);
      if (name == NULL)
        break;
      msg_outtrans_attr(name, hl_attr(HLF_D));
      vim_free(name);
      ui_breakcheck();
    }
    out_flush();
  }
  if (curwin->w_changelistidx == curbuf->b_changelistlen)
    MSG_PUTS("\n>");
}
예제 #2
0
파일: mark.c 프로젝트: 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 */
  }
}
예제 #3
0
파일: menu.c 프로젝트: Happy-Dude/neovim
/*
 * Show the mapping associated with a menu item or hierarchy in a sub-menu.
 */
static int show_menus(char_u *path_name, int modes)
{
  char_u      *p;
  char_u      *name;
  vimmenu_T   *menu;
  vimmenu_T   *parent = NULL;

  menu = root_menu;
  name = path_name = vim_strsave(path_name);

  /* First, find the (sub)menu with the given name */
  while (*name) {
    p = menu_name_skip(name);
    while (menu != NULL) {
      if (menu_name_equal(name, menu)) {
        /* Found menu */
        if (*p != NUL && menu->children == NULL) {
          EMSG(_(e_notsubmenu));
          free(path_name);
          return FAIL;
        } else if ((menu->modes & modes) == 0x0) {
          EMSG(_(e_othermode));
          free(path_name);
          return FAIL;
        }
        break;
      }
      menu = menu->next;
    }
    if (menu == NULL) {
      EMSG2(_(e_nomenu), name);
      free(path_name);
      return FAIL;
    }
    name = p;
    parent = menu;
    menu = menu->children;
  }
  free(path_name);

  /* Now we have found the matching menu, and we list the mappings */
  /* Highlight title */
  MSG_PUTS_TITLE(_("\n--- Menus ---"));

  show_menus_recursive(parent, modes, 0);
  return OK;
}
예제 #4
0
파일: mark.c 프로젝트: Davie013/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) {
        vim_free(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);
      vim_free(name);
      ui_breakcheck();
    }
    out_flush();
  }
  if (curwin->w_jumplistidx == curwin->w_jumplistlen)
    MSG_PUTS("\n>");
}