diff options
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) |