- Timestamp:
- 07/31/11 01:06:09 (13 years ago)
- File:
-
- 1 edited
-
ps/trunk/source/ps/CConsole.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/source/ps/CConsole.cpp
r9658 r9939 407 407 // BEGIN: Buffer History Lookup 408 408 case SDLK_UP: 409 if ( m_deqBufHistory.size() ) 410 { 411 int oldHistoryPos = iHistoryPos; 412 while( iHistoryPos != (int)m_deqBufHistory.size() - 1) 413 { 414 iHistoryPos++; 415 std::wstring& histString = m_deqBufHistory.at(iHistoryPos); 416 if((int)histString.length() >= m_iBufferPos) 417 { 418 bool bad = false; 419 for(int i=0; i<m_iBufferPos; i++) 420 { 421 if(histString[i] != m_szBuffer[i]) 422 { 423 bad = true; break; 424 } 425 } 426 if(!bad) 427 { 428 SetBuffer(m_deqBufHistory.at(iHistoryPos).c_str()); 429 return; 430 } 431 } 432 } 433 // if we got here, failed to find a string with the right prefix; 434 // revert to the old position in case the user types more stuff 435 iHistoryPos = oldHistoryPos; 409 if (m_deqBufHistory.size() && iHistoryPos != (int)m_deqBufHistory.size() - 1) 410 { 411 iHistoryPos++; 412 SetBuffer(m_deqBufHistory.at(iHistoryPos).c_str()); 413 m_iBufferPos = m_iBufferLength; 436 414 } 437 415 return; 438 416 439 417 case SDLK_DOWN: 440 if ( m_deqBufHistory.size() && iHistoryPos > 0 ) 441 { 442 int oldHistoryPos = iHistoryPos; 443 while( iHistoryPos != 0) 418 if (m_deqBufHistory.size()) 419 { 420 if (iHistoryPos > 0) 444 421 { 445 422 iHistoryPos--; 446 std::wstring& histString = m_deqBufHistory.at(iHistoryPos); 447 if((int)histString.length() >= m_iBufferPos) 448 { 449 bool bad = false; 450 for(int i=0; i<m_iBufferPos; i++) 451 { 452 if(histString[i] != m_szBuffer[i]) 453 { 454 bad = true; break; 455 } 456 } 457 if(!bad) 458 { 459 SetBuffer(m_deqBufHistory.at(iHistoryPos).c_str()); 460 return; 461 } 462 } 423 SetBuffer(m_deqBufHistory.at(iHistoryPos).c_str()); 424 m_iBufferPos = m_iBufferLength; 463 425 } 464 // if we got here, failed to find a string with the right prefix; 465 // revert to the old position in case the user types more stuff, 466 // and also clear any complietion we might've added going up 467 iHistoryPos = oldHistoryPos; 468 m_szBuffer[m_iBufferPos] = 0; 469 m_iBufferLength = m_iBufferPos; 426 else if (iHistoryPos == 0) 427 { 428 iHistoryPos--; 429 FlushBuffer(); 430 } 470 431 } 471 432 return;
Note:
See TracChangeset
for help on using the changeset viewer.
