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(); } }
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(); } }