fix or debug console history

This commit is contained in:
Roy Qu 2024-03-22 16:12:42 +08:00
parent 421a227d05
commit dac9bb3899
1 changed files with 2 additions and 0 deletions

View File

@ -795,6 +795,8 @@ void QConsole::loadCommandFromHistory()
mCommand = mCommandHistory[mHistoryIndex]; mCommand = mCommandHistory[mHistoryIndex];
else else
mCommand = ""; mCommand = "";
if (mHistoryIndex>mCommandHistory.length())
mHistoryIndex=mCommandHistory.length();
QString lastLine = mContents.getLastLine(); QString lastLine = mContents.getLastLine();
int len=mCurrentEditableLine.length(); int len=mCurrentEditableLine.length();
lastLine.remove(lastLine.length()-len,INT_MAX); lastLine.remove(lastLine.length()-len,INT_MAX);