From 22d15cba2a4f91cbef90ef65406dab095a982cb9 Mon Sep 17 00:00:00 2001 From: Matei Date: Sun, 22 Jan 2006 09:56:12 +0000 Subject: [PATCH] Made console history slightly smarter: if you type something and then press up or down, it will show you only those strings in history that begin with the text you typed. This was SVN commit r3398. --- source/ps/CConsole.cpp | 70 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index 5f481a3e6d..9fe86f101f 100755 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -377,19 +377,68 @@ void CConsole::InsertChar(const int szChar, const wchar_t cooked ) // BEGIN: Buffer History Lookup case SDLK_UP: - if (m_deqBufHistory.size() && iHistoryPos != (int)m_deqBufHistory.size() - 1) + if ( m_deqBufHistory.size() ) { - iHistoryPos++; - SetBuffer(m_deqBufHistory.at(iHistoryPos).data()); + int oldHistoryPos = iHistoryPos; + while( iHistoryPos != (int)m_deqBufHistory.size() - 1) + { + iHistoryPos++; + std::wstring& histString = m_deqBufHistory.at(iHistoryPos); + if(histString.length() >= m_iBufferPos) + { + bool bad = false; + for(int i=0; i= m_iBufferPos) + { + bool bad = false; + for(int i=0; i