static void keyboard_move (gint dx, gint dy) { if (kb_visible) cursor_erase (); kb_visible = TRUE; kb_xloc += dx; kb_yloc += dy; kb_xloc = (kb_xloc + board_width) % board_width; kb_yloc = (kb_yloc + board_height) % board_height; cursor_draw (kb_xloc, kb_yloc); select_cells (); }
void backspace(char **str, int *pos, UNUSED t_head *history, UNUSED int *i_history) { if (*pos > 0) { edit_str(str, pos, 0); --*pos; cursor_save(); cursor_forward(strlen(*str) - *pos); cursor_backward(1); cursor_erase(1); cursor_restore(); cursor_backward(1); cursor_erase(1); cursor_save(); fflush(stdout); write(1, "\r", 1); write(1, history->prompt, strlen(history->prompt)); write(1, *str, strlen(*str)); cursor_restore(); fflush(stdout); } }
void del(char **str, int *pos, UNUSED t_head *history, UNUSED int *i_history) { if ((*str) && *pos < (int)strlen(*str)) { edit_str(str, pos, 1); cursor_save(); cursor_forward(strlen(*str) - *pos); cursor_backward(1); cursor_erase(strlen(*str) + 1); cursor_restore(); cursor_save(); fflush(stdout); write(1, "\r", 1); write(1, history->prompt, strlen(history->prompt)); write(1, *str, strlen(*str)); cursor_restore(); fflush(stdout); } }