/* * High speed screen update. row and col are 1-based. */ void putline(int row, int col, const char *buf) { int actual_row, actual_col; get_actual_pos (row - 1, col - 1, &actual_row, &actual_col); mvaddnstr(actual_row, actual_col, buf, ncol - col + 1); }
/* * Move the cursor to the specified * origin 0 row and column position. Try to * optimize out extra moves; redisplay may * have left the cursor in the right * location last time! */ void ttmove (int row, int col) { int actual_row, actual_col; get_actual_pos (row, col, &actual_row, &actual_col); move (actual_row, actual_col); ttrow = row; ttcol = col; }
void aff_cmpl(t_shell *shell) { t_cmd *tmp; tmp = shell->com.cmd_l; check_pos(shell); shell->com.y[0] = get_actual_pos(shell); while (tmp) { if (tmp == shell->com.cursor) my_dprintf(1, PINK"%s"RES"\t", tmp->str); else my_dprintf(1, "%s\t", tmp->str); tmp = tmp->next; } shell->com.y[1] = get_actual_pos(shell); gotoyx(shell, get_actual_pos(shell) + (shell->com.y[0] - get_actual_pos(shell)), 0); }
static void check_pos(t_shell *shell) { int y; int cc; struct winsize ws; ioctl(1, TIOCGWINSZ, &ws); y = -1; cc = (count_char(&shell->com) / ws.ws_col); while (++y < cc) my_dprintf(1, "\n"); gotoyx(shell, get_actual_pos(shell) - (1 + y), 0); }
/* * Erase to end of line. */ void tteeol() { if (npages > 1) { int actual_row, actual_col, i; get_actual_pos (ttrow, ttcol, &actual_row, &actual_col); for (i = ttcol; i < ncol; i++) addch(' '); move (actual_row, actual_col); } else clrtoeol (); }