Пример #1
0
/*ARGSUSED*/
refresh(f, n)
{
	register WINDOW *wp;
	register int	oldnrow;
	register int	oldncol;

	oldnrow = nrow;
	oldncol = ncol;
	ttresize();
	if (nrow!=oldnrow || ncol!=oldncol) {
		wp = wheadp;			/* Find last.		*/
		while (wp->w_wndp != NULL)
			wp = wp->w_wndp;
		if (nrow < wp->w_toprow+3) {	/* Check if too small.	*/
			ewprintf("Display unusable");
			return (FALSE);
		}
		wp->w_ntrows = nrow-wp->w_toprow-2;
		sgarbf = TRUE;
		update();
		ewprintf("New size %d by %d", nrow, ncol);
	} else
		sgarbf = TRUE;
	return TRUE;
}
Пример #2
0
/* ARGSUSED */
int
do_redraw(int f, int n, int force)
{
	struct mgwin	*wp;
	int		 oldnrow, oldncol;

	oldnrow = nrow;
	oldncol = ncol;
	ttresize();
	if (nrow != oldnrow || ncol != oldncol || force) {

		/* find last */
		wp = wheadp;
		while (wp->w_wndp != NULL)
			wp = wp->w_wndp;

		/* check if too small */
		if (nrow < wp->w_toprow + 3) {
			dobeep();
			ewprintf("Display unusable");
			return (FALSE);
		}
		wp->w_ntrows = nrow - wp->w_toprow - 2;
		sgarbf = TRUE;
		update(CMODE);
	} else
		sgarbf = TRUE;
	return (TRUE);
}
Пример #3
0
/* 
 * rtfrmshell - back from shell, fix modes and return
 */
RETSIGTYPE
rtfrmshell(int sig)
{
    signal(SIGCONT, SIG_DFL);
    ttopen();
    ttresize();
    pclear(0, term.t_nrow);
    pico_refresh(0, 1);
}
Пример #4
0
/*
 * whelp - display help text for the composer and pico
 */
int
whelp(int f, int n)
{
    if(term.t_mrow == 0){  /* blank keymenu in effect */
	if(km_popped == 0){
	    /* cause keymenu display */
	    km_popped = 2;
	    if(!Pmaster)
	      sgarbf = TRUE;

	    return(TRUE);
	}
    }

    if(Pmaster){
	VARS_TO_SAVE *saved_state;

	saved_state = save_pico_state();
	(*Pmaster->helper)(Pmaster->composer_help,
			   Pmaster->headents
			     ? _("Help for the Alpine Composer")
			     : _("Help for Signature Editor"),
			   1);
	if(saved_state){
	    restore_pico_state(saved_state);
	    free_pico_state(saved_state);
	}

	ttresize();
	picosigs();			/* restore any altered handlers */
	curwp->w_flag |= WFMODE;
	if(km_popped)  /* this will unpop us */
	  curwp->w_flag |= WFHARD;
    }
    else{
	int mrow_was_zero = 0;

	/* always want keyhelp showing during help */
	if(term.t_mrow == 0){
	    mrow_was_zero++;
	    term.t_mrow = 2;
	}

	/* TRANSLATORS: Pico is the name of a program */
	pico_help(helptext, _("Help for Pico"), 1);
	/* put it back the way it was */
	if(mrow_was_zero)
	  term.t_mrow = 0;
    }

    sgarbf = TRUE;
    return(FALSE);
}
Пример #5
0
/*
 * Re-initialize the terminal when the editor is resumed.
 * The keypad_xmit doesn't really belong here but...
 */
void
ttreinit(void)
{
	/* check if file was modified while we were gone */
	if (fchecktime(curbp) != TRUE) {
		curbp->b_flag |= BFDIRTY;
	}

	if (enter_ca_mode)
		/* enter application mode */
		putpad(enter_ca_mode, 1);

	if (keypad_xmit)
		/* turn on keypad */
		putpad(keypad_xmit, 1);

	ttresize();
}
Пример #6
0
/*
 *  bktoshell - suspend and wait to be woken up
 */
int
bktoshell(int f, int n)
{
    UCS z = CTRL | 'Z';

    if(!(gmode&MDSSPD)){
	unknown_command(z);
	return(FALSE);
    }

    if(Pmaster){
	if(!Pmaster->suspend){
	    unknown_command(z);
	    return(FALSE);
	}

	if((*Pmaster->suspend)() == NO_OP_COMMAND){
	    int rv;
	
	    if(km_popped){
		term.t_mrow = 2;
		curwp->w_ntrows -= 2;
	    }

	    clearcursor();
	    mlerase();
	    rv = (*Pmaster->showmsg)('x');
	    ttresize();
	    picosigs();
	    if(rv)		/* Did showmsg corrupt the display? */
	      pico_refresh(0, 1);	/* Yes, repaint */

	    mpresf = 1;
	    if(km_popped){
		term.t_mrow = 0;
		curwp->w_ntrows += 2;
	    }
	}
	else{
	    ttresize();
	    pclear(0, term.t_nrow);
	    pico_refresh(0, 1);
	}

	return(TRUE);
    }

    if(gmode&MDSPWN){
	char *shell;
	int   dummy;

	vttidy();
	movecursor(0, 0);
	(*term.t_eeop)();
	printf("\n\n\nUse \"exit\" to return to Pi%s\n",
	       (gmode & MDBRONLY) ? "lot" : "co");
	system((shell = (char *)getenv("SHELL")) ? shell : "/bin/csh");
	rtfrmshell(dummy);	/* fixup tty */
    }
    else {
	movecursor(term.t_nrow-1, 0);
	peeol();
	movecursor(term.t_nrow, 0);
	peeol();
	movecursor(term.t_nrow, 0);
	printf("\n\n\nUse \"fg\" to return to Pi%s\n",
	       (gmode & MDBRONLY) ? "lot" : "co");
	ttclose();
	movecursor(term.t_nrow, 0);
	peeol();
	(*term.t_flush)();

	signal(SIGCONT, rtfrmshell);	/* prepare to restart */
	signal(SIGTSTP, SIG_DFL);			/* prepare to stop */
	kill(0, SIGTSTP);
    }

    return(TRUE);
}
Пример #7
0
void
ttinit (void)
{
  char *t, *p;
  char *tv_stype;
  int cinsl;			/* cost of inserting a line     */
  int cdell;			/* cost of deleting a line      */
  int i;
#ifdef	XKEYS
  char kname[3], lname[3];
#endif

#ifdef	VAXC
  if ((tv_stype = trnlnm ("TERM")) == NULL)
#else
  if ((tv_stype = getenv ("TERM")) == NULL)	/* Don't want VAX C getenv() */
#endif
    panic ("Environment variable TERM not defined!");

  /* If -m flag (mouse reporting) is enabled and we're running
   * on an xterm, enable X10-compatible mouse button press reporting.
   */
  if (mouse && (strncmp (tv_stype, "xterm", 5) == 0))
    {
      xterm_mouse = TRUE;
      ttputs ("\033[?9h", 5);
    }

  if ((tgetent (tcbuf, tv_stype)) != 1)
    {
      strcpy (tcbuf, "Unknown terminal type ");
      strcat (tcbuf, tv_stype);
      panic (tcbuf);
    }

  p = tcapbuf;
  t = tgetstr ("pc", &p);
  if (t)
    PC = *t;

  LI = tgetnum ("li");
  CD = tgetstr ("cd", &p);
  CM = tgetstr ("cm", &p);
  CE = tgetstr ("ce", &p);
  UP = tgetstr ("up", &p);
  BC = tgetstr ("bc", &p);
  IM = tgetstr ("im", &p);
  IC = tgetstr ("ic", &p);
  EI = tgetstr ("ei", &p);
  DC = tgetstr ("dc", &p);
  AL = tgetstr ("al", &p);
  DL = tgetstr ("dl", &p);
  pAL = tgetstr ("AL", &p);	/* parameterized insert and del. line */
  pDL = tgetstr ("DL", &p);
  TI = tgetstr ("ti", &p);
  TE = tgetstr ("te", &p);
  SO = tgetstr ("so", &p);
  SE = tgetstr ("se", &p);
  CS = tgetstr ("cs", &p);	/* set scrolling region */
  SR = tgetstr ("sr", &p);
  SG = tgetnum ("sg");		/* standout glitch      */
#ifdef	XKEYS
  /* get the 10 standard termcap keys */
  strcpy (kname, "kx");
  strcpy (lname, "lx");
  for (i = 0; i < 10; i++)
    {
      kname[1] = i + '1';
      K[i] = tgetstr (kname, &p);
      lname[1] = i + '1';
      L[i] = tgetstr (lname, &p);
    }
  /* Hack to get another bunch */
  strcpy (kname, "Kx");
  strcpy (lname, "Lx");
  for (i = 0; i < 10; i++)
    {
      kname[1] = i + '1';
      K[10 + i] = tgetstr (kname, &p);
      lname[1] = i + '1';
      L[10 + i] = tgetstr (lname, &p);
    }

  /* Get the rest of the sequences */
  KS = tgetstr ("ks", &p);
  KE = tgetstr ("ke", &p);
  KH = tgetstr ("kh", &p);
  KU = tgetstr ("ku", &p);
  KD = tgetstr ("kd", &p);
  KL = tgetstr ("kl", &p);
  KR = tgetstr ("kr", &p);
#endif

  if (CM == NULL || UP == NULL)
    panic ("This terminal is to stupid to run MicroGnuEmacs\n");
  ttresize ();			/* set nrow & ncol      */

  /* watch out for empty capabilities (sure to be wrong)  */
  if (CE && !*CE)
    CE = NULL;
  if (CS && !*CS)
    CS = NULL;
  if (SR && !*SR)
    SR = NULL;
  if (AL && !*AL)
    AL = NULL;
  if (DL && !*DL)
    DL = NULL;
  if (pAL && !*pAL)
    pAL = NULL;
  if (pDL && !*pDL)
    pDL = NULL;
  if (CD && !*CD)
    CD = NULL;

  if (!CE)
    tceeol = ncol;
  else
    tceeol = charcost (CE);

  /* Estimate cost of inserting a line */
  if (CS && SR)
    cinsl = charcost (CS) * 2 + charcost (SR);
  else if (pAL)
    cinsl = charcost (pAL);
  else if (AL)
    cinsl = charcost (AL);
  else
    cinsl = NROW * NCOL;	/* make this cost high enough */


  /* MicroEMACS requires an array of costs, not just a single value.
   * Fill the array with a single value.
   */
  for (i = 0; i <= NROW; i++)
    tcinsl[i] = 20 * cinsl * (i + 1);

  /* Estimate cost of deleting a line */
  if (CS)
    cdell = charcost (CS) * 2 + 1;
  else if (pDL)
    cdell = charcost (pDL);
  else if (DL)
    cdell = charcost (DL);
  else
    cdell = NROW * NCOL;	/* make this cost high enough */

  /* MicroEMACS requires an array of costs, not just a single value.
   * Fill the array with a single value.
   */
  for (i = 0; i <= NROW; i++)
    tcdell[i] = 20 * cdell * (i + 1);

  /* Flag to indicate that we can both insert and delete lines */
  insdel = (AL || pAL) && (DL || pDL);

  if (p >= &tcapbuf[TCAPSLEN])
    panic ("Terminal description too big!\n");
  if (TI && *TI)
    putpad (TI);		/* init the term */
}
Пример #8
0
ttinit() {
#ifdef	TCCONIO
	ttresize();			/* set nrow & ncol	*/
	tceeol = 1;
	tcinsl = 1;
	tcdell = 1;

#else
	char *tv_stype;
	char *t, *p, *tgetstr();
# ifndef gettermtype		/* (avoid declaration if #define) */
	char *gettermtype();	/* system dependent function to determin terminal type */
# endif

	if((tv_stype = gettermtype()) == NULL)
		panic("Could not determine terminal type");
	if((tgetent(tcbuf, tv_stype)) != 1) {
		(VOID) strcpy(tcbuf, "Unknown terminal type ");
		(VOID) strcat(tcbuf, tv_stype);
		panic(tcbuf);
	}

	p = tcapbuf;
	t = tgetstr("pc", &p);
	if(t) PC = *t;

	LI = tgetnum("li");
	CD = tgetstr("cd", &p);
	CM = tgetstr("cm", &p);
	CE = tgetstr("ce", &p);
	UP = tgetstr("up", &p);
	BC = tgetstr("bc", &p);
	IM = tgetstr("im", &p);
	IC = tgetstr("ic", &p);
	EI = tgetstr("ei", &p);
	DC = tgetstr("dc", &p);
	AL = tgetstr("al", &p);
	DL = tgetstr("dl", &p);
	pAL= tgetstr("AL", &p);	/* parameterized insert and del. line */
	pDL= tgetstr("DL", &p);
	TI = tgetstr("ti", &p);
	TE = tgetstr("te", &p);
	SO = tgetstr("so", &p);
	SE = tgetstr("se", &p);
	CS = tgetstr("cs", &p); /* set scrolling region */
	SF = tgetstr("sf", &p);
	if(!SF || !*SF) {	/* this is what GNU Emacs does */
		SF = tgetstr("do", &p);
		if(!SF || !*SF) {
		SF = tgetstr("nl", &p);
		if(!SF || !*SF) SF = "\n";
		}
	}
	SR = tgetstr("sr", &p);
	SG = tgetnum("sg");	/* standout glitch	*/
# ifdef	XKEYS
	KS = tgetstr("ks", &p);	/* keypad start, keypad end	*/
	KE = tgetstr("ke", &p);
# endif

	if(CM == NULL || UP == NULL)
		panic("This terminal is to stupid to run MicroGnuEmacs\n");

	ttresize();			/* set nrow & ncol	*/

	/* watch out for empty capabilities (sure to be wrong)	*/
	if (CE && !*CE) CE = NULL;
	if (CS && !*CS) CS = NULL;
	if (SR && !*SR) SR = NULL;
	if (AL && !*AL) AL = NULL;
	if (DL && !*DL) DL = NULL;
	if (pAL && !*pAL) pAL = NULL;
	if (pDL && !*pDL) pDL = NULL;
	if (CD && !*CD) CD = NULL;

	if(!CE) tceeol = ncol;
	else	tceeol = charcost(CE);

	/* Estimate cost of inserting a line */
	if (CS && SR)	tcinsl = charcost(CS)*2 + charcost(SR);
	else if (pAL)	tcinsl = charcost(pAL);
	else if (AL)	tcinsl = charcost(AL);
	else		tcinsl = NROW * NCOL;	/* make this cost high enough */

	/* Estimate cost of deleting a line */
	if (CS)		tcdell = charcost(CS)*2 + charcost(SF);
	else if (pDL)	tcdell = charcost(pDL);
	else if (DL)	tcdell = charcost(DL);
	else		tcdell = NROW * NCOL;	/* make this cost high enough */

	/* Flag to indicate that we can both insert and delete lines */
	insdel = (AL || pAL) && (DL || pDL);

	if (p >= &tcapbuf[TCAPSLEN])
		panic("Terminal description too big!\n");
	if (TI && *TI) putpad(TI, 1);	/* init the term */
#endif	/* TCCONIO */
}
Пример #9
0
/*
 * Initialize the terminal when the editor
 * gets started up.
 */
void
ttinit(void)
{
	int errret;

	if (setupterm(NULL, 1, &errret))
		panic("Terminal setup failed");

	signal(SIGWINCH, winchhandler);
	signal(SIGCONT, winchhandler);
	siginterrupt(SIGWINCH, 1);

	scroll_fwd = scroll_forward;
	if (scroll_fwd == NULL || *scroll_fwd == '\0') {
		/* this is what GNU Emacs does */
		scroll_fwd = parm_down_cursor;
		if (scroll_fwd == NULL || *scroll_fwd == '\0')
			scroll_fwd = "\n";
	}

	if (cursor_address == NULL || cursor_up == NULL)
		panic("This terminal is too stupid to run mg");

	/* set nrow & ncol */
	ttresize();

	if (!clr_eol)
		tceeol = ncol;
	else
		tceeol = charcost(clr_eol);

	/* Estimate cost of inserting a line */
	if (change_scroll_region && scroll_reverse)
		tcinsl = charcost(change_scroll_region) * 2 +
		    charcost(scroll_reverse);
	else if (parm_insert_line)
		tcinsl = charcost(parm_insert_line);
	else if (insert_line)
		tcinsl = charcost(insert_line);
	else
		/* make this cost high enough */
		tcinsl = nrow * ncol;

	/* Estimate cost of deleting a line */
	if (change_scroll_region)
		tcdell = charcost(change_scroll_region) * 2 +
		    charcost(scroll_fwd);
	else if (parm_delete_line)
		tcdell = charcost(parm_delete_line);
	else if (delete_line)
		tcdell = charcost(delete_line);
	else
		/* make this cost high enough */
		tcdell = nrow * ncol;

	/* Flag to indicate that we can both insert and delete lines */
	insdel = (insert_line || parm_insert_line) &&
	    (delete_line || parm_delete_line);

	if (enter_ca_mode)
		/* enter application mode */
		putpad(enter_ca_mode, 1);

	ttresize();
}
Пример #10
0
/*
 * pico - the main routine for Pine's composer.
 *
 */
int
pico(PICO *pm)
{
    UCS      c;
    register int    f;
    register int    n;
    char     bname[NBUFN];		/* buffer name of file to read */
    extern   struct on_display ods;
    int      checkpointcnt = 0, input = 0;
    int      ret;
    char     chkptfile[NLINE];
#ifdef	_WINDOWS
    int      cursor_shown;
#endif

    Pmaster       = pm;
    gmode	  = MDWRAP;
    gmode        |= pm->pine_flags;	/* high 4 bits rsv'd for pine */

    alt_speller   = pm->alt_spell;
    pico_all_done = 0;
    km_popped     = 0;

    if(!vtinit())			/* Init Displays.      */
      return(COMP_CANCEL);

    strncpy(bname, "main", sizeof(bname));		/* default buffer name */
    bname[sizeof(bname)-1] = '\0';
    edinit(bname);			/* Buffers, windows.   */

    if(InitMailHeader(pm))		/* init mail header structure */
      gmode &= ~(P_BODY | P_HEADEND);	/* flip off special header stuff */

    /* setup to process commands */
    lastflag = 0;			/* Fake last flags.     */
    curbp->b_mode |= gmode;		/* and set default modes*/

    if(Pmaster->pine_anchor)
      pico_anchor = utf8_to_ucs4_cpystr(Pmaster->pine_anchor);
    else
      pico_anchor = NULL;

    if(Pmaster->quote_str)
      glo_quote_str = utf8_to_ucs4_cpystr(Pmaster->quote_str);
    else
      glo_quote_str = NULL;

    if(Pmaster->wordseps)
      glo_wordseps = ucs4_cpystr(Pmaster->wordseps);
    else
      glo_wordseps = NULL;

    bindtokey(DEL, (gmode & P_DELRUBS) ? forwdel : backdel);

    if(pm->msgtext)
      breplace(pm->msgtext);

#ifdef	_WINDOWS
    cursor_shown = mswin_showcaret(1);	/* turn on for main window */
    mswin_allowpaste(MSWIN_PASTE_FULL);
    mswin_setscrollcallback (pico_scroll_callback);
#endif

    /* prepare for checkpointing */
    chkptfile[0] = '\0';
    chkptinit((*Pmaster->ckptdir)(chkptfile, sizeof(chkptfile)), sizeof(chkptfile));
    if(gmode & P_CHKPTNOW)
      writeout(chkptfile, TRUE);

    pico_all_done = setjmp(finstate);	/* jump out of HUP handler ? */

    if(gmode & MDALTNOW){
	while(!pico_all_done){
	    if(((gmode & P_BODY) || !Pmaster->headents)
	       && alt_editor(0, 1) < 0)
	      break;			/* if problem, drop into pico */

	    if(Pmaster->headents){
		update();		/* paint screen, n' start editing... */
		HeaderEditor((gmode & (P_HEADEND | P_BODY)) ? 2 : 0, 0);
		gmode |= P_BODY;	/* make sure we enter alt ed next */
	    }
	    else
	      pico_all_done = COMP_EXIT;
	}
    }
    else if(!pico_all_done){
	if(gmode & P_BODY){		/* begin editing the header? */
	    ArrangeHeader();		/* line up pointers */
	    /*
	     * Move to the offset pine asked us to move to.
	     * Perhaps we should be checking to see if this is
	     * a reasonable number before moving.
	     */
	    if(Pmaster && Pmaster->edit_offset)
	      forwchar(FALSE, Pmaster->edit_offset);
	}
	else{
	    update();			/* paint screen, */
	    HeaderEditor((gmode & P_HEADEND) ? 2 : 0, 0);
	}
    }

    while(1){
	if(pico_all_done){
#ifdef	_WINDOWS
	    if(!cursor_shown)
	      mswin_showcaret(0);

	    mswin_allowpaste(MSWIN_PASTE_DISABLE);
	    mswin_setscrollcallback (NULL);
#endif
	    ret = anycb() ? BUF_CHANGED : 0;
	    switch(pico_all_done){	/* prepare for/handle final events */
	      case COMP_EXIT :		/* already confirmed */
		packheader();
		if(Pmaster 
		   && (Pmaster->strip_ws_before_send
		       || Pmaster->allow_flowed_text))
		  cleanwhitespace();
		ret |= COMP_EXIT;
		break;

	      case COMP_CANCEL :	/* also already confirmed */
		packheader();
		ret = COMP_CANCEL;
		break;

	      case COMP_GOTHUP:
		/* 
		 * pack up and let caller know that we've received a SIGHUP
		 */
		if(ComposerEditing)		/* expand addr if needed */
		  call_builder(&headents[ods.cur_e], NULL, NULL);

		packheader();
		ret |= COMP_GOTHUP;
		break;

	      case COMP_SUSPEND :
	      default:			/* safest if internal error */
		/*
		 * If we're in the headers mark the current header line
		 * with start_here bit so caller knows where to reset.
		 * Also set the edit_offset, which is either the offset
		 * into this header line or the offset into the body.
		 * Packheader will adjust edit_offset for multi-line
		 * headers.
		 */
		if(ComposerEditing){		/* in the headers */
		    headents[ods.cur_e].start_here = 1;
		    Pmaster->edit_offset = ods.p_ind;
		}
		else{
		    register LINE *clp;
		    register long  offset;

		    for(clp = lforw(curbp->b_linep), offset = 0L;
			clp != curwp->w_dotp;
			clp = lforw(clp))
		      offset += (llength(clp) + 1);

		    Pmaster->edit_offset = offset + curwp->w_doto;
		}

		packheader();
		ret |= COMP_SUSPEND;
		break;
	    }

	    if(pico_anchor)
	      fs_give((void **) &pico_anchor);
	    if(glo_quote_str)
	      fs_give((void **) &glo_quote_str);
	    if(glo_wordseps)
	      fs_give((void **) &glo_wordseps);

	    vttidy();			/* clean up tty modes */
	    zotdisplay();		/* blast display buffers */
	    zotedit();
	    our_unlink(chkptfile);
	    Pmaster = NULL;		/* blat global */

	    return(ret);
	}

	if(km_popped){
	    km_popped--;
	    if(km_popped == 0) /* cause bottom three lines to be repainted */
	      curwp->w_flag |= WFHARD;
	}

	if(km_popped){  /* temporarily change to cause menu to be painted */
	    term.t_mrow = 2;
	    curwp->w_ntrows -= 2;
	    curwp->w_flag |= WFMODE;
	    movecursor(term.t_nrow-2, 0); /* clear status line, too */
	    peeol();
	}

	update();			/* Fix up the screen    */
	if(km_popped){
	    term.t_mrow = 0;
	    curwp->w_ntrows += 2;
	}

#ifdef	MOUSE
#ifdef  EX_MOUSE
	/* New mouse function for real mouse text seletion. */
	register_mfunc(mouse_in_pico, 2, 0, term.t_nrow - (term.t_mrow+1),
		       term.t_ncol);
#else
	mouse_in_content(KEY_MOUSE, -1, -1, -1, 0);
	register_mfunc(mouse_in_content, 2, 0, term.t_nrow - (term.t_mrow + 1),
		       term.t_ncol);
#endif
#endif
#ifdef	_WINDOWS
	mswin_setdndcallback (composer_file_drop);
	mswin_mousetrackcallback(pico_cursor);
#endif
	c = GetKey();
        if (term.t_nrow < 6 && c != NODATA){
            (*term.t_beep)();
            emlwrite(_("Please make the screen bigger."), NULL);
            continue;
        }

#ifdef	MOUSE
#ifdef  EX_MOUSE
	clear_mfunc(mouse_in_pico);
#else
	clear_mfunc(mouse_in_content);
#endif
#endif
#ifdef	_WINDOWS
	mswin_cleardndcallback ();
	mswin_mousetrackcallback(NULL);
#endif
	if(c == NODATA || time_to_check()){	/* new mail ? */
	    if((*Pmaster->newmail)(c == NODATA ? 0 : 2, 1) >= 0){
		int rv;

		if(km_popped){
		    term.t_mrow = 2;
		    curwp->w_ntrows -= 2;
		    curwp->w_flag |= WFHARD;
		    km_popped = 0;
		}

		clearcursor();
		mlerase();
		rv = (*Pmaster->showmsg)(c);
		ttresize();
		picosigs();	/* restore altered handlers */
		if(rv)		/* Did showmsg corrupt the display? */
		  PaintBody(0);	/* Yes, repaint */

		mpresf = 1;
		input = 0;
	    }

	    clearcursor();
	    movecursor(0, 0);
	}

	if(km_popped)
	  switch(c){
	    case NODATA:
	    case (CTRL|'L'):
	      km_popped++;
	      break;
	    
	    default:
	      mlerase();
	      break;
	  }

	if(c == NODATA)		/* no op, getkey timed out */
	  continue;
	else if(!input++)
	  (*Pmaster->keybinput)();

	if (mpresf != FALSE) {		/* message stay around only  */
	    if (mpresf++ > NMMESSDELAY)	/* so long! */
	      mlerase();
	}

	f = FALSE;			/* vestigial */
	n = 1;
					/* Do it.               */
	execute(normalize_cmd(c, pfkm, 2), f, n);
	if(++checkpointcnt >= CHKPTDELAY){
	    checkpointcnt = 0;
	    writeout(chkptfile, TRUE);
	}
    }
}