/* Clear current window and set as requested. * ^L - clear current window and redisplay it (default top) * <arg>^L - select new window so that current line is * the <arg>'th from top of window (0 = top line) * ^U^L - clear current line and redisplay. */ f_newwin() { register int i, n; register struct window *w; d_fixcur(); /* Ensure screen vars correct */ w = cur_win; if (exp_p) { if((n = exp) == 4 && exp_p == 4 /* CTRL-U? */ && (i = d_line(cur_dot)) >= 0) /* On valid line? */ { d_lupd(w, i); /* Update it */ return; } } else /* No argument given */ { redp(RD_SCREEN); /* Clear whole screen (later just window? */ #if IMAGEN return; #else n = (ev_nwpct*w->w_ht)/100; /* Set new window using % */ #endif /*-IMAGEN*/ } if (n < 0) n = 0; /* Ensure # is reasonable */ else if (n >= w->w_ht) n = w->w_ht - 1; d_fgoloff(-n); /* Go up given # of lines */ w->w_topldot = e_dot(); /* Set new top-line dot */ e_gocur(); /* Move back to cur_dot */ redp(RD_FIXWIN); /* Say to re-hack window */ }
f_vkmac() { register struct buffer *b, *savbuf; chroff prmplen; if(!(b = km_buf)) { ding("No kbd macro defined"); return; } savbuf = cur_buf; chg_buf(b); e_gobob(); e_sputz("Current Kbd macro:\n\n"); prmplen = e_dot(); mk_showin(b); /* Show the macro buffer temporarily */ e_gobob(); chg_buf(savbuf); sb_deln((SBBUF *)b, prmplen); /* Flush the prompt */ }
f_describe() { register char *cp; register int i, c; char str[10]; struct buffer *savbuf, *b, *make_buf(); chroff bdot; saynow("Help for command: "); i = cmd_idx(c = cmd_read()); /* Get function idx for cmd */ if(c&CB_META) sayntoo("M-"); if(i == FN_PFXMETA) { sayntoo("M-"); i = cmd_idx(c = (cmd_read() | CB_META)); } else if(i == FN_PFXEXT) { sayntoo("^X-"); i = cmd_idx(c = (cmd_read() | CB_EXT)); } str[0] = c&0177; str[1] = 0; sayntoo(str); /* Now read in the help file, if necessary */ savbuf = cur_buf; if(help_buf) chg_buf(help_buf); else { saynow("Loading "); sayntoo(ev_helpfile); sayntoo("..."); chg_buf(help_buf = make_buf(" **HELP**")); if(read_file(ev_helpfile) == 0) { chg_buf(savbuf); kill_buf(help_buf); help_buf = 0; return; } } /* Find function index in current buffer */ cp = str; *cp++ = '<'; *cp++ = 'F'; cp = dottoa(cp, (chroff)i); *cp++ = '>'; e_gobob(); if(e_search(str, cp-str, 0) == 0) sayntoo(" No help found"); else { bdot = e_dot(); while(!e_lblankp()) e_gonl(); /* Move past 1st blank line */ b = make_buf(" *SHOW*"); sb_sins((SBBUF *)b, e_copyn(bdot - e_dot())); mk_showin(b); /* Show the stuff */ kill_buf(b); sayclr(); } chg_buf(savbuf); }