int	readline_ctrl_l(t_readline *readline)
{
  egc_printf("%s", readline->capacity.capacity_clear_screen);
  readline_print_prompt(readline);
  egc_printf("%hs", readline->line);
  return (0);
}
예제 #2
0
파일: example.c 프로젝트: motet-a/egc
static int              main2()
{
  t_hs                  name;

  egc_printf("What's your name? ");
  name = read_line();
  egc_printf("Hello %hs!\n", name);
  return (0);
}
예제 #3
0
void	readline_update_cursor(const t_readline *readline)
{
  int	new_pos;

  new_pos = hs_length(readline->line);
  while (new_pos != readline->cursor_index)
    {
      egc_printf("%s", readline->capacity.capacity_cursor_left);
      new_pos--;
    }
}
예제 #4
0
int		motd_display(t_glist_hs *motd)
{
  int		i;

  i = 0;
  motd_banner();
  while (i < glist_hs_length(motd) - 1)
    {
      egc_printf("%hs\n", glist_hs_get(motd, i));
      i++;
    }
  return (0);
}
예제 #5
0
int                     readline_get_cursor_pos(t_readline *readline,
                                                int *x,
                                                int *y)
{
  struct termios	save;
  struct termios	raw;

  tcgetattr(readline->input, &save);
  raw = save;
  readline_cfmakeraw(&raw);
  if (tcsetattr(readline->input, TCSANOW, &raw) == -1)
    return (-1);
  egc_printf("\033[6n");
  if (readline_parse_cursor_position(readline->input, x, y))
    {
      tcsetattr(readline->input, TCSANOW, &save);
      return (-1);
    }
  tcsetattr(readline->input, TCSANOW, &save);
  return (0);
}
예제 #6
0
int	readline_key_home(t_readline *readline)
{
  readline->cursor_index = 0;
  egc_printf("%s", readline->capacity.capacity_cursor_home);
  return (0);
}