diff --git a/line/src/line.c b/line/src/line.c index e61ac0b4..e84f306e 100644 --- a/line/src/line.c +++ b/line/src/line.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/07 16:53:27 by maiboyer #+# #+# */ -/* Updated: 2024/07/20 14:00:06 by maiboyer ### ########.fr */ +/* Updated: 2024/07/30 17:06:59 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,6 @@ #include #include - /* This just implements a blocking loop for the multiplexed API. * In many applications that are not event-drivern, we can just call * the blocking linenoise API, wait for the user to complete the editing diff --git a/line/src/line_edit_mode.c b/line/src/line_edit_mode.c index eec28f05..dcce48b6 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/23 22:24:59 by maiboyer ### ########.fr */ +/* Updated: 2024/07/30 17:13:36 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -45,7 +45,9 @@ * fails. If stdin_fd or stdout_fd are set to -1, the default is to use * STDIN_FILENO and STDOUT_FILENO. */ -t_error line_edit_start(t_line_state *state, t_fd *stdin_fd, t_fd *stdout_fd, t_const_str prompt) +t_error line_edit_start( \ + t_line_state *state, t_fd *stdin_fd, t_fd *stdout_fd, \ + t_const_str prompt) { if (stdin_fd == NULL) stdin_fd = get_stdin(); @@ -76,7 +78,7 @@ t_error line_edit_start(t_line_state *state, t_fd *stdin_fd, t_fd *stdout_fd, t_ * called in a loop, and block. * - * The function returns get_unfinished_str() to signal that line editing is still + * The function returns get_unfinished_str() to signal that line editing is still * in progress, that is, the user didn't yet pressed enter / CTRL-D. Otherwise * the function returns the pointer to the heap-allocated buffer with the * edited line, that the user should mem_free with linenoiseFree(). @@ -88,13 +90,13 @@ t_error line_edit_start(t_line_state *state, t_fd *stdin_fd, t_fd *stdout_fd, t_ * * Some other errno: I/O error. */ -bool line_edit_feed(t_line_state *state, t_str *out) +bool line_edit_feed(t_line_state *state, t_str *out) { - char c; - t_isize nread; - char seq[3]; - t_vec_str *history; - t_str tmp; + char c; + t_isize nread; + char seq[3]; + t_vec_str *history; + t_str tmp; if (out == NULL) return (true); @@ -202,11 +204,11 @@ bool line_edit_feed(t_line_state *state, t_str *out) * for more information. This function is called when linenoiseEditFeed() * returns something different than NULL. At this point the user input * 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) { string_free(state->buf); if (!isatty(state->input_fd->fd)) - return; + return ; line_disable_raw_mode(state->input_fd); me_printf_fd(state->output_fd, "\n"); } diff --git a/line/src/line_editing.c b/line/src/line_editing.c index 0178f47d..2cfc7468 100644 --- a/line/src/line_editing.c +++ b/line/src/line_editing.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/11 18:21:45 by maiboyer #+# #+# */ -/* Updated: 2024/07/20 15:33:01 by maiboyer ### ########.fr */ +/* Updated: 2024/07/30 17:07:59 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -55,7 +55,7 @@ t_usize line_get_prompt_len(t_const_str s) if ('@' <= s[i] && s[i] <= '~') i++; } - else + else _modify_vars(&i, &ret, true); } return (ret); diff --git a/line/src/line_internals.c b/line/src/line_internals.c index 1b441693..9d34d719 100644 --- a/line/src/line_internals.c +++ b/line/src/line_internals.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/11 18:18:46 by maiboyer #+# #+# */ -/* Updated: 2024/07/20 15:02:53 by maiboyer ### ########.fr */ +/* Updated: 2024/07/30 17:08:24 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,7 +24,8 @@ /* Use the ESC [6n escape sequence to query the horizontal cursor position * and return it. On error -1 is returned, on success the position of the * cursor. */ -/*t_error line_get_cursor_position(t_fd *input, t_fd *output, t_u32 *column_out) +/*t_error line_get_cursor_position( \ + t_fd *input, t_fd *output, t_u32 *column_out) { char buf[32]; t_u32 i; diff --git a/line/src/line_no_tty.c b/line/src/line_no_tty.c index 92d33a22..58f0d97d 100644 --- a/line/src/line_no_tty.c +++ b/line/src/line_no_tty.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/11 18:10:24 by maiboyer #+# #+# */ -/* Updated: 2024/07/20 13:51:27 by maiboyer ### ########.fr */ +/* Updated: 2024/07/30 17:14:18 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,11 +20,11 @@ * program using linenoise is called in pipe or with a file redirected * to its standard input. In this case, we want to be able to return the * line regardless of its length (by default we are limited to 4k). */ -bool line_no_tty_impl(t_str *out) +bool line_no_tty_impl(t_str *out) { - t_string line; - t_isize ret; - char chr; + t_string line; + t_isize ret; + char chr; line = string_new(16); while (true)