From 6adb78d6f3c11ab64ee62d514391cf6797febca6 Mon Sep 17 00:00:00 2001 From: Maieul BOYER Date: Tue, 23 Jul 2024 22:22:04 +0000 Subject: [PATCH] Fixed line Stuff --- line/Makefile | 6 +++--- line/src/line_edit_mode.c | 9 +++++---- sources/main.c | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/line/Makefile b/line/Makefile index 31e424c9..20a58705 100644 --- a/line/Makefile +++ b/line/Makefile @@ -6,7 +6,7 @@ # By: maiboyer +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/03 13:20:01 by maiboyer #+# #+# # -# Updated: 2024/07/23 21:53:05 by maiboyer ### ########.fr # +# Updated: 2024/07/23 22:07:26 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -22,8 +22,8 @@ NAME = lib$(ANAME).a LIB_NAME ?= TARGET = $(BUILD_DIR)/$(NAME) CC ?= clang -CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -CFLAGS = $(CFLAGS_ADDITIONAL) +CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -g3 +CFLAGS += $(CFLAGS_ADDITIONAL) -include Filelist.$(ANAME).mk diff --git a/line/src/line_edit_mode.c b/line/src/line_edit_mode.c index 87f70c85..cce2679b 100644 --- a/line/src/line_edit_mode.c +++ b/line/src/line_edit_mode.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/11 18:26:32 by maiboyer #+# #+# */ -/* Updated: 2024/07/20 14:32:14 by maiboyer ### ########.fr */ +/* Updated: 2024/07/23 22:19:04 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -57,12 +57,12 @@ t_error line_edit_start(t_line_state *state, t_fd *stdin_fd, t_fd *stdout_fd, t_ state->prompt = prompt; state->prompt_len = str_len(state->prompt); state->pos = 0; + if (!isatty(state->input_fd->fd)) + return (NO_ERROR); if (line_enable_raw_mode(state->input_fd)) return (ERROR); state->columns = line_get_columns(stdin_fd, stdout_fd); state->history_index = 0; - if (!isatty(state->input_fd->fd)) - return (NO_ERROR); line_history_add(""); if (write_fd(state->output_fd, (t_u8 *)prompt, state->prompt_len, NULL)) return (ERROR); @@ -204,9 +204,10 @@ bool line_edit_feed(t_line_state *state, t_str *out) * is in the buffer, and we can restore the terminal in normal mode. */ void line_edit_stop(t_line_state *state) { + printf("stopping\n"); + string_free(state->buf); if (!isatty(state->input_fd->fd)) return; line_disable_raw_mode(state->input_fd); me_printf_fd(state->output_fd, "\n"); - string_free(state->buf); } diff --git a/sources/main.c b/sources/main.c index 66ffef48..71c5b5b6 100644 --- a/sources/main.c +++ b/sources/main.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */ -/* Updated: 2024/07/20 15:30:46 by maiboyer ### ########.fr */ +/* Updated: 2024/07/23 22:16:02 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */