Browse Source

[norm] history: five f() per file.

Moul 3 years ago
parent
commit
a366e44813
3 changed files with 25 additions and 25 deletions
  1. 0 23
      src/history.c
  2. 23 0
      src/history_tools.c
  3. 2 2
      src/term.h

+ 0 - 23
src/history.c

@@ -73,26 +73,3 @@ void	move_on_history(t_e *e, int side)
 	else if (side == DOWN && e->hist->yng == NULL)
 		e->first = 1;
 }
-
-void	display_history(t_e *e, int side)
-{
-	if (side == DOWN && e->first == 1)
-	{
-		print_history("");
-		ft_strdel(&e->cmd);
-		e->cmd = ft_strnew(0);
-	}
-	else
-		print_history(e->hist->cmd);
-}
-
-/*
-** Hide current line, display prompt and cmd
-*/
-
-void	print_history(char *cmd)
-{
-	term_action("dl");
-	term_action("cr");
-	ft_printf("%s%s", PROMPT, cmd);
-}

+ 23 - 0
src/history_tools.c

@@ -20,3 +20,26 @@ void	display_all_hist(t_e *e)
 		e->hist = e->hist->old;
 	}
 }
+
+void	display_history(t_e *e, int side)
+{
+	if (side == DOWN && e->first == 1)
+	{
+		print_history("");
+		ft_strdel(&e->cmd);
+		e->cmd = ft_strnew(0);
+	}
+	else
+		print_history(e->hist->cmd);
+}
+
+/*
+** Hide current line, display prompt and cmd
+*/
+
+void	print_history(char *cmd)
+{
+	term_action("dl");
+	term_action("cr");
+	ft_printf("%s%s", PROMPT, cmd);
+}

+ 2 - 2
src/term.h

@@ -48,11 +48,11 @@ void	save_history(t_e *e, t_hist *new);
 t_hist	*new_hist(char *cmd);
 void	move_history(t_e *e, int side);
 void	move_on_history(t_e *e, int side);
-void	display_history(t_e *e, int side);
-void	print_history(char *cmd);
 /*
 ** history_tools.c
 */
+void	display_history(t_e *e, int side);
+void	print_history(char *cmd);
 void	go_to_young_hist(t_e *e);
 void	display_all_hist(t_e *e);