From bc3da16935b52f007c64c22952735277efae1395 Mon Sep 17 00:00:00 2001 From: Maieul BOYER Date: Sat, 12 Oct 2024 18:00:45 +0200 Subject: [PATCH] update: renamed some stuff in line --- line/include/line/_line_functions.h | 2 +- line/include/line/line.h | 2 +- line/src/line.c | 6 +++--- line/src/line_edit_mode.c | 18 +++++++++--------- line/src/line_history.c | 2 +- line/src/line_no_tty.c | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/line/include/line/_line_functions.h b/line/include/line/_line_functions.h index 796e8a69..c9bd3bf3 100644 --- a/line/include/line/_line_functions.h +++ b/line/include/line/_line_functions.h @@ -30,7 +30,7 @@ void line_edit_move_left(t_line_state *state); void line_edit_move_right(t_line_state *state); void line_edit_stop(t_line_state *state); -t_str linenoise(t_const_str prompt); +t_str line(t_const_str prompt); t_str line_blocking_edit(t_fd *stdin_fd, t_fd *stdout_fd, t_const_str prompt); bool line_history_add(t_const_str line); diff --git a/line/include/line/line.h b/line/include/line/line.h index 1908f2c4..707e5819 100644 --- a/line/include/line/line.h +++ b/line/include/line/line.h @@ -11,7 +11,7 @@ /* ************************************************************************** */ /// This code is higly inspired by this repository/libary: -/// https://github.com/antirez/linenoise +/// https://github.com/antirez/line #ifndef LINE_H # define LINE_H diff --git a/line/src/line.c b/line/src/line.c index cad91182..d550b4f6 100644 --- a/line/src/line.c +++ b/line/src/line.c @@ -24,7 +24,7 @@ /* 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 + * the blocking line API, wait for the user to complete the editing * and return the buffer. */ t_str line_blocking_edit(t_fd *stdin_fd, t_fd *stdout_fd, t_const_str prompt) { @@ -38,12 +38,12 @@ t_str line_blocking_edit(t_fd *stdin_fd, t_fd *stdout_fd, t_const_str prompt) return (res); } -/* The high level function that is the main API of the linenoise library. +/* The high level function that is the main API of the line library. * This function checks if the terminal has basic capabilities, just checking * for a blacklist of stupid terminals, and later either calls the line * editing function or uses dummy fgets() so that you will be able to type * something even in the most desperate of the conditions. */ -t_str linenoise(t_const_str prompt) +t_str line(t_const_str prompt) { t_str retval; diff --git a/line/src/line_edit_mode.c b/line/src/line_edit_mode.c index 397c371c..2e5f07b0 100644 --- a/line/src/line_edit_mode.c +++ b/line/src/line_edit_mode.c @@ -24,24 +24,24 @@ bool line_edit_feed_block_ret(t_line_state *state, t_str *out, char c, \ bool *ret); -/* This function is part of the multiplexed API of Linenoise, that is used +/* This function is part of the multiplexed API of line, that is used * in order to implement the blocking variant of the API but can also be * called by the user directly in an event driven program. It will: * - * 1. Initialize the linenoise state passed by the user. + * 1. Initialize the line state passed by the user. * 2. Put the terminal in RAW mode. * 3. Show the prompt. - * 4. Return control to the user, that will have to call linenoiseEditFeed() + * 4. Return control to the user, that will have to call lineEditFeed() * each time there is some data arriving in the standard input. * - * The user can also call linenoiseEditHide() and linenoiseEditShow() if it + * The user can also call lineEditHide() and lineEditShow() if it * is required to show some input arriving asyncronously, without mixing * it with the currently edited line. * - * When linenoiseEditFeed() returns non-NULL, the user finished with the + * When lineEditFeed() returns non-NULL, the user finished with the * line editing session (pressed enter CTRL-D/C): in this case the caller - * needs to call linenoiseEditStop() to put back the terminal in normal - * mode. This will not destroy the buffer, as long as the linenoiseState + * needs to call lineEditStop() to put back the terminal in normal + * mode. This will not destroy the buffer, as long as the lineState * is still valid in the context of the caller. * * The function returns 0 on success, or -1 if writing to standard output @@ -95,8 +95,8 @@ bool line_edit_feed(t_line_state *state, t_str *out) return (false); } -/* This is part of the multiplexed linenoise API. See linenoiseEditStart() - * for more information. This function is called when linenoiseEditFeed() +/* This is part of the multiplexed line API. See lineEditStart() + * for more information. This function is called when lineEditFeed() * 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) diff --git a/line/src/line_history.c b/line/src/line_history.c index 1e6df29d..2df82448 100644 --- a/line/src/line_history.c +++ b/line/src/line_history.c @@ -19,7 +19,7 @@ /* ================================ History ================================= */ -/* This is the API call to add a new entry in the linenoise history. +/* This is the API call to add a new entry in the line history. * It uses a fixed array of char pointers that are shifted (memmoved) * when the history max length is reached in order to remove the older * entry and make room for the new one, so it is not exactly suitable for huge diff --git a/line/src/line_no_tty.c b/line/src/line_no_tty.c index 5d065e06..7b1c3390 100644 --- a/line/src/line_no_tty.c +++ b/line/src/line_no_tty.c @@ -15,9 +15,9 @@ #include "line/_line_structs.h" #include "me/types.h" -/* This function is called when linenoise() is called with the standard +/* This function is called when line() is called with the standard * input file descriptor not attached to a TTY. So for example when the - * program using linenoise is called in pipe or with a file redirected + * program using line 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)