示例#1
0
文件: mark.c 项目: meh/screen
void MarkRoutine()
{
	int x, y;

	if (InitOverlayPage(sizeof(*markdata), &MarkLf, 1))
		return;
	flayer->l_encoding = fore->w_encoding;
	flayer->l_mode = 1;
	markdata = (struct markdata *)flayer->l_data;
	markdata->md_user = D_user;	/* XXX: Correct? */
	markdata->md_window = fore;
	markdata->second = 0;
	markdata->rep_cnt = 0;
	markdata->append_mode = 0;
	markdata->write_buffer = 0;
	markdata->nonl = 0;
	markdata->left_mar = 0;
	markdata->right_mar = fore->w_width - 1;
	markdata->hist_offset = fore->w_histheight;
	x = fore->w_x;
	y = D2W(fore->w_y);
	if (x >= fore->w_width)
		x = fore->w_width - 1;

	LGotoPos(flayer, x, W2D(y));
	LMsg(0, "Copy mode - Column %d Line %d(+%d) (%d,%d)",
	     x + 1, W2D(y + 1), fore->w_histheight, fore->w_width, fore->w_height);
	markdata->cx = markdata->x1 = x;
	markdata->cy = markdata->y1 = y;
	flayer->l_x = x;
	flayer->l_y = W2D(y);
}
示例#2
0
文件: input.c 项目: skoneka/screen
/*
 * We dont use HS status line with Input().
 * If we would use it, then we should check e_tgetflag("es") if
 * we are allowed to use esc sequences there.
 *
 * mode is an OR of
 * INP_NOECHO == suppress echoing of characters.
 * INP_RAW    == raw mode. call finfunc after each character typed.
 * INP_EVERY  == digraph mode.
 */
void
Input(char *istr, int len, int mode, void (*finfunc) (char *buf, int len, char *priv), char *priv, int data)
{
  int maxlen;
  struct inpdata *inpdata;
  
  if (!flayer)
    return;

  if (len > 100)
    len = 100;
  if (!(mode & INP_NOECHO))
    {
      maxlen = flayer->l_width - 1 - strlen(istr);
      if (len > maxlen)
	len = maxlen;
    }
  if (len < 0)
    {
      LMsg(0, "Width %d chars too small", -len);
      return;
    }
  if (InitOverlayPage(sizeof(*inpdata), &InpLf, 1))
    return;
  flayer->l_mode = 1;
  inpdata = (struct inpdata *)flayer->l_data;
  inpdata->inpmaxlen = len;
  inpdata->inpfinfunc = finfunc;
  inpdata->inp.pos = inpdata->inp.len = 0;
  inpdata->inp.prev = inphist.prev;
  inpdata->inpmode = mode;
  inpdata->privdata = data;
  if (!priv)
    priv = (char*)&inpdata->privdata;
  inpdata->priv = priv;
  inpdata->inpstringlen = 0;
  inpdata->inpstring = NULL;
  inpdata->search = NULL;
  if (istr)
    inp_setprompt(istr, (char *)NULL);
}