コード例 #1
0
ファイル: txtfield.c プロジェクト: kurtjd/sChat
void tf_backspace(TxtField *tf)
{
    // Don't want this function running if there is no input.
    if (tf == NULL || tf->length < 1)
        return;

    // The index in the message buffer to perform deletion.
    unsigned delete_at = (TF_CURSOR_POS - 1) + ECHO_OFFSET;

    for (size_t i = delete_at; i < tf->length; ++i)
        tf->value[i] = tf->value[i + 1];

    moveby(0, -1);
    delch();
    --tf->length;

    if (get_cursor(X) <= tf->x)
        tf_reset_echo(tf);
        /* Remember: This can cause prompt to be removed by tf_backspace if cursor offset is not 0.
         * Will fix after fixing the issue with inserting text in the middle of the message. */
}
コード例 #2
0
ファイル: grup.cpp プロジェクト: cmin764/cmiN
void Grup<T, R>::moveBy(T a, T b)
{
    MoveBy<T, R> moveby(a, b);
    for_each(continut.begin(), continut.end(), moveby);
}