Fixed line Stuff
This commit is contained in:
parent
c3626fc59e
commit
6adb78d6f3
3 changed files with 9 additions and 8 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
# By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2023/11/03 13:20:01 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 ?=
|
LIB_NAME ?=
|
||||||
TARGET = $(BUILD_DIR)/$(NAME)
|
TARGET = $(BUILD_DIR)/$(NAME)
|
||||||
CC ?= clang
|
CC ?= clang
|
||||||
CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"'
|
CFLAGS = -Wno-unused-command-line-argument -Wall -Werror -Wextra -g3 -L$(BUILD_DIR) -MMD -rdynamic -DBASE_PATH='"$(BASE_PATH)/"' -g3
|
||||||
CFLAGS = $(CFLAGS_ADDITIONAL)
|
CFLAGS += $(CFLAGS_ADDITIONAL)
|
||||||
|
|
||||||
-include Filelist.$(ANAME).mk
|
-include Filelist.$(ANAME).mk
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/07/11 18:26:32 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 = prompt;
|
||||||
state->prompt_len = str_len(state->prompt);
|
state->prompt_len = str_len(state->prompt);
|
||||||
state->pos = 0;
|
state->pos = 0;
|
||||||
|
if (!isatty(state->input_fd->fd))
|
||||||
|
return (NO_ERROR);
|
||||||
if (line_enable_raw_mode(state->input_fd))
|
if (line_enable_raw_mode(state->input_fd))
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
state->columns = line_get_columns(stdin_fd, stdout_fd);
|
state->columns = line_get_columns(stdin_fd, stdout_fd);
|
||||||
state->history_index = 0;
|
state->history_index = 0;
|
||||||
if (!isatty(state->input_fd->fd))
|
|
||||||
return (NO_ERROR);
|
|
||||||
line_history_add("");
|
line_history_add("");
|
||||||
if (write_fd(state->output_fd, (t_u8 *)prompt, state->prompt_len, NULL))
|
if (write_fd(state->output_fd, (t_u8 *)prompt, state->prompt_len, NULL))
|
||||||
return (ERROR);
|
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. */
|
* is in the buffer, and we can restore the terminal in normal mode. */
|
||||||
void line_edit_stop(t_line_state *state)
|
void line_edit_stop(t_line_state *state)
|
||||||
{
|
{
|
||||||
|
printf("stopping\n");
|
||||||
|
string_free(state->buf);
|
||||||
if (!isatty(state->input_fd->fd))
|
if (!isatty(state->input_fd->fd))
|
||||||
return;
|
return;
|
||||||
line_disable_raw_mode(state->input_fd);
|
line_disable_raw_mode(state->input_fd);
|
||||||
me_printf_fd(state->output_fd, "\n");
|
me_printf_fd(state->output_fd, "\n");
|
||||||
string_free(state->buf);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/03/28 14:40:38 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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue