diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-09-20 13:51:01 +0200 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-09-20 13:51:01 +0200 |
commit | 0a5e031d87dc504e6928bca1b74a6e081c76b870 (patch) | |
tree | 1e180c7f755e716083f31feda87f5db338635c44 /src/c_input.c | |
parent | full bugged, mais full features (diff) | |
download | 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.tar.gz 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.tar.bz2 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.tar.xz 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.tar.zst 42-minishell-0a5e031d87dc504e6928bca1b74a6e081c76b870.zip |
reworking redraw line lets go
Diffstat (limited to 'src/c_input.c')
-rw-r--r-- | src/c_input.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/c_input.c b/src/c_input.c index 5e9db72..4dab9f0 100644 --- a/src/c_input.c +++ b/src/c_input.c @@ -46,14 +46,39 @@ int16_t tcaps->HM[3] = 0; tcaps->ND[0] = 27; tcaps->ND[1] = 91; - tcaps->ND[2] = -103; - tcaps->ND[3] = 0; + tcaps->ND[2] = 52; + tcaps->ND[3] = 126; return (1); } else return (-1); } +uint32_t +c_get_line_num(char *line, + uint32_t cpos, + uint32_t plen, + t_caps *tcaps) +{ + uint32_t it; + uint32_t line_num; + uint32_t len; + + it = 0; + line_num = 0; + tcaps->lpos = 0; + len = ft_strlen(line); + if (len < (tcaps->ws.ws_col - plen)) + return (1); + while (it < len) + { + it += (it == 0) ? (tcaps->ws.ws_col - plen) : tcaps->ws.ws_col; + tcaps->lpos += (it < cpos) ? 1 : 0; + line_num++; + } + return (line_num); +} + int16_t c_back_slash(char **line, t_caps *tcaps) |