summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-09-27 13:18:40 +0200
committersalad <fmoenne-@student.le-101.fr>2020-09-27 13:18:40 +0200
commit22b3aeab0a3a688085a3b4c85be75ef52d889975 (patch)
treed0019637eb8adf9887c4c896f0a4f3a8490ee687 /src
parenttransfert (diff)
download42-minishell-22b3aeab0a3a688085a3b4c85be75ef52d889975.tar.gz
42-minishell-22b3aeab0a3a688085a3b4c85be75ef52d889975.tar.bz2
42-minishell-22b3aeab0a3a688085a3b4c85be75ef52d889975.tar.xz
42-minishell-22b3aeab0a3a688085a3b4c85be75ef52d889975.tar.zst
42-minishell-22b3aeab0a3a688085a3b4c85be75ef52d889975.zip
THI S IS THE END
Diffstat (limited to 'src')
-rw-r--r--src/c_keys.c19
-rw-r--r--src/c_utils.c1
2 files changed, 16 insertions, 4 deletions
diff --git a/src/c_keys.c b/src/c_keys.c
index c303a91..d37a76e 100644
--- a/src/c_keys.c
+++ b/src/c_keys.c
@@ -60,13 +60,24 @@ int16_t
uint16_t i;
uint16_t j;
- i = (tcaps->lpos > 0) ? tcaps->cpos : (tcaps->ws.ws_col * tcaps->nlines - 1);
- j = 0;
- if (tcaps->cpos < size && tcaps->lpos > 0)
+ /* i = (tcaps->nlines == (tcaps->lpos)) ? 0 : tcaps->ws.ws_col * (tcaps->lpos); */
+ i = 0;
+ j = (tcaps->lpos);
+ if (tcaps->cpos < size && j < tcaps->nlines)
{
- while (j++ < (tcaps->nlines - 1))
+ while (j < (tcaps->nlines))
+ {
tputs(tgetstr("do", NULL), 1, ft_putchar);
+ j++;
+ i += tcaps->ws.ws_col;
+ }
tputs(tgetstr("cr", NULL), 1, ft_putchar);
+ /* ft_printf("[%d][%d]", i, size); */
+ while (i < (size + 13))
+ {
+ tputs(tgetstr("nd", NULL), 1, ft_putchar);
+ i++;
+ }
}
else
while (i++ < size)
diff --git a/src/c_utils.c b/src/c_utils.c
index 834f192..24545f3 100644
--- a/src/c_utils.c
+++ b/src/c_utils.c
@@ -176,5 +176,6 @@ int16_t
while (--len > tcaps->cpos)
tputs(tgetstr("le", NULL), 1, ft_putchar);
}
+ tcaps->nlines = c_get_line_num(line, tcaps->cpos, ft_strlen(msh->ps[0]), tcaps);
return (ret);
}