diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | src/c_init.c | 5 | ||||
-rw-r--r-- | src/c_utils.c | 22 |
3 files changed, 20 insertions, 11 deletions
@@ -90,12 +90,12 @@ ifeq (${OS}, FreeBSD) CC = /usr/bin/cc endif ifeq (${OS}, Linux) -CC = clang-8 +CC = clang endif ifeq (${OS}, Darwin) CC = clang endif -#CFLAGS = -std=c89 +CFLAGS = -std=c89 CFLAGS = -Wall CFLAGS += -Wextra CFLAGS += -Werror diff --git a/src/c_init.c b/src/c_init.c index bb6383d..ac0c579 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -77,10 +77,7 @@ int16_t } if (ft_isprint(buf[0])) { - if (tcaps->cpos == ft_strlen(line)) - line = ft_strjoin(line, buf); - else - line = c_insert_char(line, buf[0], tcaps); + line = c_insert_char(line, buf[0], tcaps); c_redraw_line(line, tcaps, msh); tcaps->cpos++; } diff --git a/src/c_utils.c b/src/c_utils.c index b50280d..35c95ef 100644 --- a/src/c_utils.c +++ b/src/c_utils.c @@ -24,13 +24,11 @@ /* ** TODO: -** leaks on line +** MULTILIGHNE ** quotes ** C-c ** NORME -** MULTILIGHNE -** term(0) on exit DONE -** cursor on char insert DONE +** leaks on line ??? GONE ? */ int16_t @@ -171,8 +169,22 @@ int16_t int16_t ret; i = 0; - tputs(tgetstr("cr", NULL), 1, ft_putchar); len = ft_strlen(line); + tputs(tgetstr("cr", NULL), 1, ft_putchar); + if (len >= (tcaps->ws.ws_col - ft_strlen(msh->ps[0]))) + { + if (len == (tcaps->ws.ws_col - ft_strlen(msh->ps[0]))) + { + tputs(tgetstr("sf", NULL), 1, ft_putchar); + return (1); + } + else + { + tputs(tgetstr("sf", NULL), 1, ft_putchar); + tputs(tgetstr("up", NULL), 1, ft_putchar); + tputs(tgetstr("up", NULL), 1, ft_putchar); + } + } while (i < ft_strlen(msh->ps[0])) { tputs(tgetstr("nd", NULL), 1, ft_putchar); |