コード例 #1
0
ファイル: TCommandLine.cpp プロジェクト: Aico/sfmudlet
void TCommandLine::historyUp(QKeyEvent *event)
{
    if( mHistoryList.size() < 1 ) return;
    if( (textCursor().selectedText().size() == toPlainText().size()) || (toPlainText().size() == 0) )
    {
        if( toPlainText().size() != 0) mHistoryBuffer++;
        if( mHistoryBuffer >= mHistoryList.size() ) mHistoryBuffer = mHistoryList.size()-1;
        if( mHistoryBuffer < 0 ) mHistoryBuffer = 0;
        setPlainText( mHistoryList[mHistoryBuffer] );
        selectAll();
        adjustHeight();
    }
    else
    {
        mAutoCompletionCount++;
        handleAutoCompletion();
    }
}
コード例 #2
0
ファイル: TCommandLine.cpp プロジェクト: Mudlet/Mudlet
void TCommandLine::historyDown(QKeyEvent* event)
{
    if (mHistoryList.empty()) {
        return;
    }
    if ((textCursor().selectedText().size() == toPlainText().size()) || (toPlainText().size() == 0)) {
        mHistoryBuffer--;
        if (mHistoryBuffer >= mHistoryList.size()) {
            mHistoryBuffer = mHistoryList.size() - 1;
        }
        if (mHistoryBuffer < 0) {
            mHistoryBuffer = 0;
        }
        setPlainText(mHistoryList[mHistoryBuffer]);
        selectAll();
        adjustHeight();
    } else {
        mAutoCompletionCount--;
        handleAutoCompletion();
    }
}