update: renamed some stuff in line

This commit is contained in:
Maieul BOYER 2024-10-12 18:00:45 +02:00
parent d550ffab53
commit bc3da16935
No known key found for this signature in database
6 changed files with 17 additions and 17 deletions

View file

@ -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);

View file

@ -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

View file

@ -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;

View file

@ -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)

View file

@ -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

View file

@ -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)