Fixed some bugs line got after norming
This commit is contained in:
parent
c911ad463d
commit
b49c304a3e
4 changed files with 16 additions and 11 deletions
|
|
@ -6,12 +6,13 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/11 18:24:03 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/07/11 18:24:20 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/07/30 18:03:01 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "line/_line_functions.h"
|
||||
#include "line/_line_structs.h"
|
||||
#include "me/printf/printf.h"
|
||||
|
||||
/* Insert the character 'c' at cursor current position.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/11 18:24:49 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/07/11 18:25:55 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/07/30 18:16:52 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -55,6 +55,8 @@ void line_edit_delete(t_line_state *state)
|
|||
line_refresh_line(state);
|
||||
}
|
||||
|
||||
// use this to print when a backspace
|
||||
// fprintf(stderr, "\x1b[A\x1b[A\x1b[D backspace \x1b[B\x1b[B\x1b[10D");
|
||||
/* Backspace implementation. */
|
||||
void line_edit_backspace(t_line_state *state)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/11 18:26:32 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/07/30 17:46:10 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/07/30 18:16:22 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
#include "me/str/str.h"
|
||||
#include "me/vec/vec_str.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
bool line_edit_feed_block_ret(t_line_state *state, t_str *out, char c, \
|
||||
bool *ret);
|
||||
|
|
@ -73,6 +74,8 @@ t_error line_edit_start( \
|
|||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
// use this to print the char as hex above the cursor
|
||||
// fprintf(stderr, "\x1b[A\x1b[D char = %02x \x1b[B\x1b[10D", c);
|
||||
bool line_edit_feed(t_line_state *state, t_str *out)
|
||||
{
|
||||
bool ret;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/30 17:19:01 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/07/30 17:48:10 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/07/30 18:17:49 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -75,11 +75,13 @@ bool line_edit_feed_block_ret(t_line_state *state, t_str *out, \
|
|||
{
|
||||
char seq[3];
|
||||
|
||||
if (c == K_CTRL_C)
|
||||
if (line_edit_feed_block1(state, out, c))
|
||||
*ret = false;
|
||||
else if (c == K_CTRL_C)
|
||||
{
|
||||
errno = EAGAIN;
|
||||
*out = NULL;
|
||||
*ret = true;
|
||||
*ret = false;
|
||||
}
|
||||
else if (c == K_NEWLINE || c == K_ENTER)
|
||||
*ret = line_edit_feed_enter(state, out, seq);
|
||||
|
|
@ -89,12 +91,9 @@ bool line_edit_feed_block_ret(t_line_state *state, t_str *out, \
|
|||
*ret = line_edit_feed_esc(state, out, seq);
|
||||
else if (c == K_SIGQUIT)
|
||||
*ret = false;
|
||||
else
|
||||
{
|
||||
else if (c >= '\x00' && c <= '\x1F')
|
||||
*ret = false;
|
||||
if (line_edit_feed_block1(state, out, c))
|
||||
return (true);
|
||||
else
|
||||
return (false);
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue