Fix padding multicolumn

This commit is contained in:
M600 2017-03-10 11:46:48 +01:00
parent b8324bdc51
commit 12c35ed904
4 changed files with 44 additions and 7 deletions

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/10 09:04:42 by alao #+# #+# */ /* Created: 2017/03/10 09:04:42 by alao #+# #+# */
/* Updated: 2017/03/10 09:57:44 by alao ### ########.fr */ /* Updated: 2017/03/10 10:21:01 by alao ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -29,6 +29,17 @@ static void c_arrow_right(t_comp *c)
i += c->c_line - (c->c_sy - ((c->c_pline - 1) * c->c_line)); i += c->c_line - (c->c_sy - ((c->c_pline - 1) * c->c_line));
i++; i++;
} }
DG("POSX [%d] C_PLINE [%d]", c->pos_x, c->c_line);
if (c->pos_x == (c->c_pline - 1))
{
DG("X");
i = c->c_line - (c->c_sy - ((c->c_pline - 1) * c->c_line));
while (i < c->c_line)
{
ptr = ptr->next;
i++;
}
}
ptr->cursor = 1; ptr->cursor = 1;
} }
@ -49,6 +60,15 @@ static void c_arrow_left(t_comp *c)
i += c->c_line - (c->c_sy - ((c->c_pline - 1) * c->c_line)); i += c->c_line - (c->c_sy - ((c->c_pline - 1) * c->c_line));
i++; i++;
} }
/* if (c->pos_x == 1)
{
i = c->c_line - (c->c_sy - ((c->c_pline - 1) * c->c_line));
while (i < c->c_line)
{
ptr = ptr->prev;
i++;
}
}*/
ptr->cursor = 1; ptr->cursor = 1;
} }

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 11:21:16 by alao #+# #+# */ /* Created: 2017/01/09 11:21:16 by alao #+# #+# */
/* Updated: 2017/03/10 08:32:11 by alao ### ########.fr */ /* Updated: 2017/03/10 11:38:35 by alao ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -60,6 +60,7 @@ static void c_init_base(t_comp *c)
c->m_size += ft_strlen(data_singleton()->line.input); c->m_size += ft_strlen(data_singleton()->line.input);
c->m_size = (c->m_size / c->win_y); c->m_size = (c->m_size / c->win_y);
c->m_size = c->win_y - c->m_size - 1; c->m_size = c->win_y - c->m_size - 1;
DG("MS [%d] WX %d WY %d", c->m_size, c->win_x, c->win_y);
c->pos_x = 1; c->pos_x = 1;
c->pos_y = 1; c->pos_y = 1;
c->cutpoint = 0; c->cutpoint = 0;

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/10 12:55:39 by alao #+# #+# */ /* Created: 2017/01/10 12:55:39 by alao #+# #+# */
/* Updated: 2017/03/10 08:45:06 by alao ### ########.fr */ /* Updated: 2017/03/10 10:18:16 by alao ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -98,6 +98,8 @@ static t_clst *c_rolling(t_comp *c)
y = 1; y = 1;
while ((y * (c->m_size - 1)) < id) while ((y * (c->m_size - 1)) < id)
y++; y++;
c->pos_x = x;
c->pos_y = y;
if (y > 1) if (y > 1)
{ {
c->pos_x = x; c->pos_x = x;

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/11 10:44:40 by alao #+# #+# */ /* Created: 2016/10/11 10:44:40 by alao #+# #+# */
/* Updated: 2017/03/10 10:00:03 by alao ### ########.fr */ /* Updated: 2017/03/10 11:45:57 by alao ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -43,9 +43,14 @@ void c_term_mv_back(t_comp *c)
{ {
int i; int i;
int lcmd; int lcmd;
int value;
i = 0; i = 0;
while (i != (c->m_size)) if (c->c_sy > c->win_y)
value = c->m_size;
else
value = c->c_line;
while (i != value)
{ {
ft_putstr(tgetstr("up", NULL)); ft_putstr(tgetstr("up", NULL));
i++; i++;
@ -69,16 +74,25 @@ void c_term_mv_back(t_comp *c)
void c_term_mv_down(t_comp *c) void c_term_mv_down(t_comp *c)
{ {
int i; int i;
int value;
i = 0; i = 0;
while (i < c->m_size + 1) if (c->c_sy > c->win_y)
value = c->m_size + 1;
else
value = c->c_line;
while (i < value)
{ {
ft_putstr(tgetstr("do", NULL)); ft_putstr(tgetstr("do", NULL));
ft_putstr(tgetstr("cd", NULL)); ft_putstr(tgetstr("cd", NULL));
i++; i++;
} }
i = 0; i = 0;
while (i != (c->m_size - 1)) if (c->c_sy > c->win_y)
value = c->m_size - 1;
else
value = c->c_line - 1;
while (i != value)
{ {
ft_putstr(tgetstr("up", NULL)); ft_putstr(tgetstr("up", NULL));
i++; i++;