Example #1
0
File: read.c Project: Fusiow/msh
int		distrib_buttons(int i, char **result, char *buffer, int *v)
{
	if (buffer[0] == 10)
		return (-2);
	else if (buffer[0] == 27 && buffer[1] == 91)
		i = distrib_arrow(i, result, buffer, v);
	else if (buffer[0] == 127)
		*result = del_c(*result, &i);
	else if (buffer[0] == 9 && *result && i == ft_strlen(*result))
		i = distrib_tab(i, result);
	else if (buffer[0] == 12)
		clear_and_prompt();
	else if (buffer[0] == 1)
		i = ctrl_a(i, result);
	else if (buffer[0] == 5)
		i = ctrl_k(i, result);
	else if (buffer[0] == 21)
	{
		clear_line(i + 1, ft_strlen(*result));
		*result = NULL;
		i = 0;
	}
	else if (buffer[0] == 4)
		ft_exit(NULL);
	else
		ft_putstr(tgetstr("le", NULL));
	return (i);
}
Example #2
0
void			edition(t_termcap *term, t_history **history,
				struct winsize *mysizewin, int count)
{
  if (term->buff == CTRL_K)
    term->tmp = ctrl_k(term->str, &term->data, &term->x);
  else if (term->buff == CTRL_Y)
    {
      if (term->tmp != NULL)
	term->str = ctrl_y(term->str, term->tmp, &term->x, &term->data);
    }
  else if (term->buff == CTRL_L)
    ctrl_l(term->str, &term->data);
  else if (term->buff == DOWN)
    term->str = history_down(history, term, mysizewin);
  else if (term->buff == UP)
    term->str = history_up(history, term, mysizewin);
  else if (count == 0)
    term->str = write_normally(term->str, term->buff, &term->x, &term->data);
}