fix probleme completion + tres grosse ligne - on ne se decale plus
This commit is contained in:
parent
1ce1ce2cd1
commit
930eb5f59a
2 changed files with 6 additions and 21 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
||||||
# Updated: 2017/03/21 10:36:25 by gwojda ### ########.fr #
|
# Updated: 2017/03/21 11:05:18 by gwojda ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,28 +6,12 @@
|
||||||
/* 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/18 15:19:18 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 11:22:03 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "completion.h"
|
||||||
|
|
||||||
static size_t c_virtual_position(t_comp *c)
|
|
||||||
{
|
|
||||||
char *str;
|
|
||||||
size_t pos;
|
|
||||||
size_t virtual_pos;
|
|
||||||
|
|
||||||
pos = c->ircmd;
|
|
||||||
virtual_pos = pos;
|
|
||||||
str = data_singleton()->line.input;
|
|
||||||
while (pos && str[pos] != '\n')
|
|
||||||
--pos;
|
|
||||||
if (str[pos] == '\n')
|
|
||||||
++pos;
|
|
||||||
return (virtual_pos - pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Clear the previous list from the screen and restore the same position.
|
** Clear the previous list from the screen and restore the same position.
|
||||||
*/
|
*/
|
||||||
|
|
@ -42,7 +26,8 @@ void c_term_clear(t_comp *c)
|
||||||
ft_putstr(tgetstr("up", NULL));
|
ft_putstr(tgetstr("up", NULL));
|
||||||
i = 0;
|
i = 0;
|
||||||
lcmd = 0;
|
lcmd = 0;
|
||||||
c->rcmd ? lcmd += c_virtual_position(c) + c->prompt + 1 : 0;
|
lcmd = (c->rcmd) ? ft_nb_last_line(data_singleton()->line.input,
|
||||||
|
data_singleton()->line.pos) : 0;
|
||||||
while (i < lcmd)
|
while (i < lcmd)
|
||||||
{
|
{
|
||||||
ft_putstr(tgetstr("nd", NULL));
|
ft_putstr(tgetstr("nd", NULL));
|
||||||
|
|
@ -73,8 +58,8 @@ void c_term_mv_back(t_comp *c)
|
||||||
}
|
}
|
||||||
ft_putstr(tgetstr("cr", NULL));
|
ft_putstr(tgetstr("cr", NULL));
|
||||||
i = 0;
|
i = 0;
|
||||||
lcmd = 0;
|
lcmd = (c->rcmd) ? ft_nb_last_line(data_singleton()->line.input,
|
||||||
c->rcmd ? lcmd += c_virtual_position(c) + c->prompt + 1 : 0;
|
data_singleton()->line.pos) : 0;
|
||||||
while (i < lcmd)
|
while (i < lcmd)
|
||||||
{
|
{
|
||||||
ft_putstr(tgetstr("nd", NULL));
|
ft_putstr(tgetstr("nd", NULL));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue