diff options
Diffstat (limited to '')
-rw-r--r-- | src/c_init.c | 4 | ||||
-rw-r--r-- | src/c_init.h | 2 | ||||
-rw-r--r-- | src/c_input.c | 2 | ||||
-rw-r--r-- | src/c_utils.c | 4 |
4 files changed, 8 insertions, 4 deletions
diff --git a/src/c_init.c b/src/c_init.c index de10dfa..745fad9 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -65,9 +65,9 @@ c_read_cap(char *buf, t_caps *tcaps, t_msh *msh) { - if ((*((unsigned int *)buf)) == LEFT_K) + if (((*((unsigned int *)buf)) == LEFT_K) || ((*((unsigned int *)buf)) == CTRL_B)) return (c_key_left(ft_strlen(msh->ps[tcaps->psx]), tcaps)); - else if ((*((unsigned int *)buf)) == RIGHT_K) + else if (((*((unsigned int *)buf)) == RIGHT_K) || ((*((unsigned int *)buf)) == CTRL_F)) return (c_key_right(ft_strlen(line), ft_strlen(msh->ps[tcaps->psx]), tcaps)); else if ((*((unsigned int *)buf)) == HOME_K) return (c_home_key(tcaps)); diff --git a/src/c_init.h b/src/c_init.h index 5dd4a13..6317871 100644 --- a/src/c_init.h +++ b/src/c_init.h @@ -25,6 +25,8 @@ # define DEL_K 0x7f # define RET_K 0x0d +# define CTRL_F 0x06 +# define CTRL_B 0x02 # define CTRL_C 0x03 # define CTRL_L 0x0c diff --git a/src/c_input.c b/src/c_input.c index 19d2ef3..7eb8084 100644 --- a/src/c_input.c +++ b/src/c_input.c @@ -68,7 +68,7 @@ c_get_line_num(char *line, while (it < len) { it += (it == 0) ? (tcaps->ws.ws_col - plen) : tcaps->ws.ws_col; - tcaps->lpos += (it < cpos) ? 1 : 0; + tcaps->lpos += (it <= (cpos)) ? 1 : 0; line_num++; } return (line_num); diff --git a/src/c_utils.c b/src/c_utils.c index a62e3f9..23d5007 100644 --- a/src/c_utils.c +++ b/src/c_utils.c @@ -112,6 +112,7 @@ static int16_t uint32_t i; uint32_t j; + /* ft_printf("%u%u", tcaps->nlines, tcaps->lpos); */ i = (tcaps->nlines == tcaps->lpos) ? 0 : tcaps->ws.ws_col * (tcaps->lpos - 1); j = tcaps->nlines; if (tcaps->nlines != tcaps->lpos) @@ -147,10 +148,11 @@ int16_t i = 0; j = tcaps->lpos; tputs(tgetstr("cr", NULL), 1, ft_putchar); - if ((((tcaps->cpos - 1) + ft_strlen(msh->ps[tcaps->psx])) % + if ((((tcaps->cpos + 1) + ft_strlen(msh->ps[tcaps->psx])) % tcaps->ws.ws_col) == 0) { tputs(tgetstr("sf", NULL), 1, ft_putchar); + return (1); } while (--j > 0) { |