예제 #1
0
파일: move.c 프로젝트: gregballot/42sh
int	term_up(char **send, unsigned long int buff,
		  t_comp *count, t_tab *stock)
{
  char	*cp;
  char	*s1;

  (void)buff;
  if (!stock->list)
    return (0);
  cp = tgetstr("dl", NULL);
  s1 = tgoto(cp, 0, 0);
  if (my_tputs(s1, 0, my_putchar) == -1)
    return (-1);
  cp = tgetstr("ch", NULL);
  s1 = tgoto(cp, 0, 0);
  if (my_tputs(s1, 0, my_putchar) == -1)
    return (-1);
  prompt(stock);
  if (stock && stock->move && stock->list->next)
    stock->list = stock->list->next;
  free(*send);
  my_putstr(stock->list->data);
  *send = my_strdup(stock->list->data);
  count->save = my_strlen(stock->list->data);
  count->compt = count->save;
  stock->move = 1;
  return (0);
}
예제 #2
0
int	eol(t_elem *e)
{
  my_tputs(e->cap[VI]);
  while (move_right(e) != -1);
  my_tputs(e->cap[VE]);
  return (0);
}
예제 #3
0
int	destroy(struct termios *t)
{
  if (tcsetattr(0, 0, t) == -1)
    {
      fprintf(stderr, TERMCAP_ERR);
      return (-1);
    }
  my_tputs(tgetstr("is", NULL));
  my_tputs(tgetstr("rs", NULL));
  return (0);
}
예제 #4
0
파일: clear.c 프로젝트: SASDOE/my_select
void	clearscreen(t_list *root)
{
  int	i;

  i = 0;
  while (i < root->nb_elem)
  {
    my_tputs(tgetstr("up", NULL));
    i = i + 1;
  }
  i = 0;
  while (i < root->nb_elem)
  {
    my_tputs(tgetstr("dl", NULL));
    i = i + 1;
  }
}
예제 #5
0
int	ctrl_y(t_elem *e)
{
  t_string	*cpy;
  t_string	*save;

  if (taille_clip(e) < 1)
    return (0);
  save = e->cursor;
  cpy = e->clipboard;
  my_tputs(e->cap[VI]);
  _bol(e, 0);
  while (e->cursor != save)
    e->cursor = e->cursor->next;
  past(e, cpy, save);
  my_tputs(e->cap[VE]);
  return (0);
}
예제 #6
0
int	init_termcaps(struct termios *t)
{
  if (tcgetattr(0, t) == -1)
    return (-1);
 if (raw_mode(t) == -1)
    return (-1);
  if (d_echo(t) == -1)
    return (-1);
  my_tputs(tgetstr("im", NULL));
  return (0);
}
예제 #7
0
int	past(t_elem *e, t_string *cpy, t_string *save)
{
  if (e->clipboard)
    {
      while (cpy)
	{
	  my_tputs(e->cap[VI]);
	  push_char(e, cpy->c, 0);
	  cpy = cpy->next;
	}
      e->cursor = e->s;
      my_tputs(e->cap[VI]);
      while (move_right_write(e) != -1);
      my_tputs(e->cap[VI]);
      _bol(e, 0);
      my_tputs(e->cap[VI]);
      while (e->cursor != save)
	move_right(e);
    }
  return (0);
}
예제 #8
0
int	ctrl_k(t_elem *e)
{
  free_string_edit(e->clipboard);
  e->clipboard = NULL;
  string_dup(e);
  my_tputs(e->cap[CD]);
  if (e->cursor->next)
    free_end_of_clip(e->cursor->next);
  e->cursor->c = 0;
  e->cursor->next = NULL;
  e->len -= taille_clip(e);
  return (0);
}
예제 #9
0
파일: move.c 프로젝트: gregballot/42sh
int	term_right(char **send, unsigned long int buff,
		   t_comp *count, t_tab *stock)
{
  char	*cp;
  char	*s1;

  (void)buff;
  (void)stock;
  (void)send;
  if (count->compt != count->save)
    {
      count->compt++;
      cp = tgetstr("RI", NULL);
      s1 = tgoto(cp, 1, 0);
      if (my_tputs(s1, 0, my_putchar) == -1)
	return (-1);
    }
  return (0);
}
예제 #10
0
void	rm_line(t_elem *e)
{
  bol(e);
  my_tputs(e->cap[CD]);
}