Changeset 5986 for code/branches/console/src/libraries/core/Shell.cc
- Timestamp:
- Oct 22, 2009, 11:32:30 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/libraries/core/Shell.cc
r5983 r5986 30 30 31 31 #include "util/OutputHandler.h" 32 #include "util/StringUtils.h" 32 33 #include "CommandExecutor.h" 33 34 #include "CoreIncludes.h" … … 132 133 this->inputBuffer_->registerListener(this, &Shell::scroll_up, KeyCode::PageUp); 133 134 this->inputBuffer_->registerListener(this, &Shell::scroll_down, KeyCode::PageDown); 135 this->inputBuffer_->registerListener(this, &Shell::history_search_up, KeyCode::AltPageUp); 136 this->inputBuffer_->registerListener(this, &Shell::history_search_down, KeyCode::AltPageDown); 134 137 } 135 138 … … 357 360 } 358 361 362 void Shell::history_search_up() 363 { 364 if (this->historyPosition_ == this->historyOffset_) 365 return; 366 unsigned int cursorPosition = this->getCursorPosition(); 367 std::string input_str( this->getInput().substr(0,cursorPosition) ); //only search for the expression from the beginning of the inputline untill the cursor position 368 for (unsigned int newPos = this->historyPosition_+1; newPos<=this->historyOffset_; newPos++) 369 { 370 if (getLowercase(this->commandHistory_[this->historyOffset_ - newPos]).find(getLowercase(input_str)) == 0) //search case insensitive 371 { 372 this->historyPosition_ = newPos; 373 this->inputBuffer_->set(this->getFromHistory()); 374 this->setCursorPosition( cursorPosition ); 375 return; 376 } 377 } 378 } 379 380 void Shell::history_search_down() 381 { 382 if (this->historyPosition_ == 0) 383 return; 384 unsigned int cursorPosition = this->getCursorPosition(); 385 std::string input_str( this->getInput().substr(0,cursorPosition) ); //only search for the expression from the beginn$ 386 for (unsigned int newPos = this->historyPosition_-1; newPos>0; newPos--) 387 { 388 if (getLowercase(this->commandHistory_[this->historyOffset_ - newPos]).find(getLowercase(input_str)) == 0) //sear$ 389 { 390 this->historyPosition_ = newPos; 391 this->inputBuffer_->set(this->getFromHistory()); 392 this->setCursorPosition( cursorPosition ); 393 return; 394 } 395 } 396 } 397 359 398 void Shell::scroll_up() 360 399 {
Note: See TracChangeset
for help on using the changeset viewer.