⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 curs_main.c

📁 mutt-1.5.12 源代码。linux 下邮件接受的工具。
💻 C
📖 第 1 页 / 共 4 页
字号:
	if (menu->redraw & REDRAW_INDEX)	{	  menu_redraw_index (menu);	  menu->redraw |= REDRAW_STATUS;	}	else if (menu->redraw & (REDRAW_MOTION_RESYNCH | REDRAW_MOTION))	  menu_redraw_motion (menu);	else if (menu->redraw & REDRAW_CURRENT)	  menu_redraw_current (menu);      }      if (menu->redraw & REDRAW_STATUS)       {	menu_status_line (buf, sizeof (buf), menu, NONULL (Status));	CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);	SETCOLOR (MT_COLOR_STATUS);        BKGDSET (MT_COLOR_STATUS);	mutt_paddstr (COLS, buf);	SETCOLOR (MT_COLOR_NORMAL);        BKGDSET (MT_COLOR_NORMAL);	menu->redraw &= ~REDRAW_STATUS;      }      menu->redraw = 0;      if (menu->current < menu->max)	menu->oldcurrent = menu->current;      else	menu->oldcurrent = -1;      if (option (OPTARROWCURSOR))	move (menu->current - menu->top + menu->offset, 2);      else if (option (OPTBRAILLEFRIENDLY))	move (menu->current - menu->top + menu->offset, 0);      else	move (menu->current - menu->top + menu->offset, COLS - 1);      mutt_refresh ();#if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM)      if (SigWinch)      {	mutt_flushinp ();	mutt_resize_screen ();	menu->redraw = REDRAW_FULL;	menu->menu = MENU_MAIN;	SigWinch = 0;	menu->top = 0; /* so we scroll the right amount */	/*	 * force a real complete redraw.  clrtobot() doesn't seem to be able	 * to handle every case without this.	 */	clearok(stdscr,TRUE);	continue;      }#endif      op = km_dokey (MENU_MAIN);      dprint(4, (debugfile, "mutt_index_menu[%d]: Got op %d\n", __LINE__, op));      if (op == -1)	continue; /* either user abort or timeout */            mutt_curs_set (1);            /* special handling for the tag-prefix function */      if (op == OP_TAG_PREFIX)      {	if (!Context)	{	  mutt_error _("No mailbox is open.");	  continue;	}	if (!Context->tagged)	{	  mutt_error _("No tagged messages.");	  continue;	}	tag = 1;	/* give visual indication that the next command is a tag- command */	mvaddstr (LINES - 1, 0, "tag-");	clrtoeol ();	/* get the real command */	if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX)	{	  /* abort tag sequence */	  CLEARLINE (LINES-1);	  continue;	}      }      else if (option (OPTAUTOTAG) && Context && Context->tagged)	tag = 1;      if (op == OP_TAG_PREFIX_COND)      {	if (!Context)	{	  mutt_error _("No mailbox is open.");	  continue;	}	if (!Context->tagged)	{	  event_t tmp;	  while(UngetCount>0)	  {	    tmp=mutt_getch();	    if(tmp.op==OP_END_COND)break;	  }	  mutt_message  _("Nothing to do.");	  continue;	}	tag = 1;	/* give visual indication that the next command is a tag- command */	mvaddstr (LINES - 1, 0, "tag-");	clrtoeol ();	/* get the real command */	if ((op = km_dokey (MENU_MAIN)) == OP_TAG_PREFIX)	{	  /* abort tag sequence */	  CLEARLINE (LINES-1);	  continue;	}      }      mutt_clear_error ();    }    else    {      if (menu->current < menu->max)	menu->oldcurrent = menu->current;      else	menu->oldcurrent = -1;            mutt_curs_set (1);	/* fallback from the pager */    }    switch (op)    {      /* ----------------------------------------------------------------------       * movement commands       */      case OP_BOTTOM_PAGE:	menu_bottom_page (menu);	break;      case OP_FIRST_ENTRY:	menu_first_entry (menu);	break;      case OP_MIDDLE_PAGE:	menu_middle_page (menu);	break;      case OP_HALF_UP:	menu_half_up (menu);	break;      case OP_HALF_DOWN:	menu_half_down (menu);	break;      case OP_NEXT_LINE:	menu_next_line (menu);	break;      case OP_PREV_LINE:	menu_prev_line (menu);	break;      case OP_NEXT_PAGE:	menu_next_page (menu);	break;      case OP_PREV_PAGE:	menu_prev_page (menu);	break;      case OP_LAST_ENTRY:	menu_last_entry (menu);	break;      case OP_TOP_PAGE:	menu_top_page (menu);	break;      case OP_CURRENT_TOP:	menu_current_top (menu);	break;      case OP_CURRENT_MIDDLE:	menu_current_middle (menu);	break;      case OP_CURRENT_BOTTOM:	menu_current_bottom (menu);	break;      case OP_JUMP:	CHECK_MSGCOUNT;        CHECK_VISIBLE;        if (isdigit (LastKey)) mutt_ungetch (LastKey, 0);	buf[0] = 0;	if (mutt_get_field (_("Jump to message: "), buf, sizeof (buf), 0) != 0	    || !buf[0])	  break;	if (! isdigit ((unsigned char) buf[0]))	{	  mutt_error _("Argument must be a message number.");	  break;	}	i = atoi (buf);	if (i > 0 && i <= Context->msgcount)	{	  for (j = i-1; j < Context->msgcount; j++)	  {	    if (Context->hdrs[j]->virtual != -1)	      break;	  }	  if (j >= Context->msgcount)	  {	    for (j = i-2; j >= 0; j--)	    {	      if (Context->hdrs[j]->virtual != -1)		break;	    }	  }	  if (j >= 0)	  {	    menu->current = Context->hdrs[j]->virtual;	    if (menu->menu == MENU_PAGER)	    {	      op = OP_DISPLAY_MESSAGE;	      continue;	    }	    else	    menu->redraw = REDRAW_MOTION;	  }	  else	    mutt_error _("That message is not visible.");	}	else	  mutt_error _("Invalid message number.");	break;	/* --------------------------------------------------------------------	 * `index' specific commands	 */      case OP_MAIN_DELETE_PATTERN:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_READONLY;	CHECK_IMAP_ACL(IMAP_ACL_DELETE);	CHECK_ATTACH;	mutt_pattern_func (M_DELETE, _("Delete messages matching: "));	menu->redraw = REDRAW_INDEX | REDRAW_STATUS;	break;#ifdef USE_POP      case OP_MAIN_FETCH_MAIL:	CHECK_ATTACH;	pop_fetch_mail ();	menu->redraw = REDRAW_FULL;	break;#endif /* USE_POP */      case OP_HELP:	mutt_help (MENU_MAIN);	menu->redraw = REDRAW_FULL;	break;      case OP_MAIN_SHOW_LIMIT:	CHECK_IN_MAILBOX;	if (!Context->pattern)	   mutt_message _("No limit pattern is in effect.");	else	{	   char buf[STRING];	   /* i18n: ask for a limit to apply */	   snprintf (buf, sizeof(buf), _("Limit: %s"),Context->pattern);           mutt_message ("%s", buf);	}        break;      case OP_MAIN_LIMIT:	CHECK_IN_MAILBOX;	menu->oldcurrent = (Context->vcount && menu->current >= 0 && menu->current < Context->vcount) ?		CURHDR->index : -1;	if (mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)	{	  if (menu->oldcurrent >= 0)	  {	    /* try to find what used to be the current message */	    menu->current = -1;	    for (i = 0; i < Context->vcount; i++)	      if (Context->hdrs[Context->v2r[i]]->index == menu->oldcurrent)	      {		menu->current = i;		break;	      }	    if (menu->current < 0) menu->current = 0;	  }	  else	    menu->current = 0;	  menu->redraw = REDRAW_INDEX | REDRAW_STATUS;	  if (Context->msgcount && (Sort & SORT_MASK) == SORT_THREADS)	    mutt_draw_tree (Context);	  menu->redraw = REDRAW_FULL;	}        if (Context->pattern)	  mutt_message _("To view all messages, limit to \"all\".");	break;	        case OP_QUIT:	close = op;	if (attach_msg)	{	 done = 1;	 break;	}	if (query_quadoption (OPT_QUIT, _("Quit Mutt?")) == M_YES)	{	  int check;	  	  oldcount = Context ? Context->msgcount : 0;	  if (!Context || (check = mx_close_mailbox (Context, &index_hint)) == 0)	    done = 1;	  else	  {	    if (check == M_NEW_MAIL || check == M_REOPENED)	      update_index (menu, Context, check, oldcount, index_hint);	    menu->redraw = REDRAW_FULL; /* new mail arrived? */	    set_option (OPTSEARCHINVALID);	  }	}	break;      case OP_REDRAW:	clearok (stdscr, TRUE);	menu->redraw = REDRAW_FULL;	break;      case OP_SEARCH:      case OP_SEARCH_REVERSE:      case OP_SEARCH_NEXT:      case OP_SEARCH_OPPOSITE:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	if ((menu->current = mutt_search_command (menu->current, op)) == -1)	  menu->current = menu->oldcurrent;	else	  menu->redraw = REDRAW_MOTION;	break;      case OP_SORT:      case OP_SORT_REVERSE:	if (mutt_select_sort ((op == OP_SORT_REVERSE)) == 0)	{	  if (Context && Context->msgcount)	  {	    resort_index (menu);	    set_option (OPTSEARCHINVALID);	  }	}	break;      case OP_TAG:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	if (tag && !option (OPTAUTOTAG))	{	  for (j = 0; j < Context->vcount; j++)	    mutt_set_flag (Context, Context->hdrs[Context->v2r[j]], M_TAG, 0);	  menu->redraw = REDRAW_STATUS | REDRAW_INDEX;	}	else	{	  mutt_set_flag (Context, CURHDR, M_TAG, !CURHDR->tagged);	  Context->last_tag = CURHDR->tagged ? CURHDR :	    ((Context->last_tag == CURHDR && !CURHDR->tagged)	     ? NULL : Context->last_tag);	  menu->redraw = REDRAW_STATUS;	  if (option (OPTRESOLVE) && menu->current < Context->vcount - 1)	  {	    menu->current++;	    menu->redraw |= REDRAW_MOTION_RESYNCH;	  }	  else	    menu->redraw |= REDRAW_CURRENT;	}	break;      case OP_MAIN_TAG_PATTERN:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	mutt_pattern_func (M_TAG, _("Tag messages matching: "));	menu->redraw = REDRAW_INDEX | REDRAW_STATUS;	break;      case OP_MAIN_UNDELETE_PATTERN:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_READONLY;	CHECK_IMAP_ACL(IMAP_ACL_DELETE);	if (mutt_pattern_func (M_UNDELETE, _("Undelete messages matching: ")) == 0)	  menu->redraw = REDRAW_INDEX | REDRAW_STATUS;	break;      case OP_MAIN_UNTAG_PATTERN:	CHECK_MSGCOUNT;        CHECK_VISIBLE;	if (mutt_pattern_func (M_UNTAG, _("Untag messages matching: ")) == 0)	  menu->redraw = REDRAW_INDEX | REDRAW_STATUS;	break;	/* --------------------------------------------------------------------	 * The following operations can be performed inside of the pager.	 */#ifdef USE_IMAP      case OP_MAIN_IMAP_FETCH:	if (Context && Context->magic == M_IMAP)	  imap_check_mailbox (Context, &index_hint, 1);        break;#endif            case OP_MAIN_SYNC_FOLDER:	if (Context && !Context->msgcount)	  break;	CHECK_MSGCOUNT;        CHECK_VISIBLE;	CHECK_READONLY;	{	  int oldvcount = Context->vcount;	  int oldcount  = Context->msgcount;	  int dcount = 0;	  int check;	  /* calculate the number of messages _above_ the cursor,	   * so we can keep the cursor on the current message	   */ 	  for (j = 0; j <= menu->current; j++)	  {	    if (Context->hdrs[Context->v2r[j]]->deleted)	      dcount++;	  }	  if ((check = mx_sync_mailbox (Context, &index_hint)) == 0)	  {	    if (Context->vcount != oldvcount)	      menu->current -= dcount;	    set_option (OPTSEARCHINVALID);	  }	  else if (check == M_NEW_MAIL || check == M_REOPENED)	    update_index (menu, Context, check, oldcount, index_hint);	  /* 	   * do a sanity check even if mx_sync_mailbox failed.	   */	  if (menu->current < 0 || menu->current >= Context->vcount)	    menu->current = ci_first_message ();	}	/* check for a fatal error, or all messages deleted */	if (!Context->path)	  FREE (&Context);	/* if we were in the pager, redisplay the message */	if (menu->menu == MENU_PAGER)	{	  op = OP_DISPLAY_MESSAGE;	  continue;	}        else	  menu->redraw = REDRAW_FULL;	break;      case OP_MAIN_CHANGE_FOLDER:      	if (attach_msg)	  op = OP_MAIN_CHANGE_FOLDER_READONLY;	/* fallback to the readonly case */      case OP_MAIN_CHANGE_FOLDER_READONLY:        if ((op == OP_MAIN_CHANGE_FOLDER_READONLY) || option (OPTREADONLY))          cp = _("Open mailbox in read-only mode");        else          cp = _("Open mailbox");	buf[0] = '\0';	mutt_buffy (buf, sizeof (buf));	if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)        {          if (menu->menu == MENU_PAGER)          {            op = OP_DISPLAY_MESSAGE;            continue;          }          else            break;        }	if (!buf[0])	{	  CLEARLINE (LINES-1);	  break;	}	mutt_expand_path (buf, sizeof (buf));	if (mx_get_magic (buf) <= 0)	{	  mutt_error (_("%s is not a mailbox."), buf);	  break;	}	mutt_str_replace (&CurrentFolder, buf);        if (Context)        {	  int check;	  mutt_str_replace (&LastFolder, Context->path);	  oldcount = Context ? Context->msgcount : 0;	  if ((check = mx_close_mailbox (Context, &index_hint)) != 0)	  {	    if (check == M_NEW_MAIL || check == M_REOPENED)	      update_index (menu, Context, check, oldcount, index_hint);			    set_option (OPTSEARCHINVALID);	    menu->redraw = REDRAW_INDEX | REDRAW_STATUS;	    break;	  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -