void Root_widget::pop_cursor() { // All cursors but the top one must be freed after use if (_cursor_stack.size() > 1) { free_cursor( get_current_cursor() ); } set_cursor(_cursor_stack.top()); _cursor_stack.pop(); }
void exec_del_and_move_left(t_sh *shell, t_term *term) { t_term *prev_link; (void)shell; term = get_current_cursor(term); if (term->prev) { prev_link = term->prev; if (prev_link->prev) prev_link->prev->next = term; term->prev = prev_link->prev; free(prev_link); ft_putstr(tgetstr("le", NULL)); ft_putstr(tgetstr("dc", NULL)); } }
void exec_del_right(t_sh *shell, t_term *term) { t_term *next_link; (void)shell; term = get_current_cursor(term); if (term->next) { next_link = term->next; if (term->prev) term->prev->next = next_link; next_link->prev = term->prev; free(term); next_link->cursor = 1; ft_putstr(tgetstr("dc", NULL)); } }
char *get_prev_chars(t_term *term) { char *buf; char *rev; int i; i = 0; if ((buf = ft_strnew(COMP_SIZE))) { term = get_current_cursor(term); if (term->c == ' ' && term->prev) term = term->prev; while (term && i < COMP_SIZE && term->c != ' ') { buf[i] = (char)term->c; term = term->prev; i++; } } rev = ft_strrev(buf); free(buf); return (rev); }
void Root_widget::push_cursor(Cursor_handle cursor) { _cursor_stack.push( get_current_cursor() ); set_cursor(cursor); }