Changeset 5784 in orxonox.OLD for trunk/src/lib/shell/shell_input.cc
- Timestamp:
- Nov 26, 2005, 8:48:11 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/shell/shell_input.cc
r5639 r5784 49 49 this->inputLine = new char[1]; 50 50 this->inputLine[0] = '\0'; 51 this->history = new tList<char>; 52 this->historyIT = this->history->getIterator(); 51 this->historyIT = this->history.begin(); 53 52 this->setHistoryLength(50); 54 53 this->historyScrolling = false; … … 75 74 delete this->completion; 76 75 77 char* histEl = this->historyIT->firstElement(); 78 while (histEl != NULL) 79 { 80 delete[] histEl; 81 histEl = this->historyIT->nextElement(); 82 } 83 delete this->historyIT; 84 delete this->history; 76 while (!this->history.empty()) 77 { 78 delete[] this->history.front(); 79 this->history.pop_front(); 80 } 85 81 } 86 82 … … 139 135 if (this->historyScrolling) 140 136 { 141 delete[] this->history ->lastElement();142 this->history ->remove(this->history->lastElement());137 delete[] this->history.back(); 138 this->history.pop_back(); 143 139 this->historyScrolling = false; 144 140 } … … 160 156 if (this->historyScrolling) 161 157 { 162 delete[] this->history ->lastElement();163 this->history ->remove(this->history->lastElement());158 delete[] this->history.back(); 159 this->history.pop_back(); 164 160 this->historyScrolling = false; 165 161 } … … 181 177 if (this->historyScrolling) 182 178 { 183 delete[] this->history ->lastElement();184 this->history ->remove(this->history->lastElement());179 delete[] this->history.back(); 180 this->history.pop_back(); 185 181 this->historyScrolling = false; 186 182 } … … 220 216 if (this->historyScrolling) 221 217 { 222 delete[] this->history ->lastElement();223 this->history ->remove(this->history->lastElement());218 delete[] this->history.back(); 219 this->history.pop_back(); 224 220 this->historyScrolling = false; 225 221 } 226 222 227 223 // adding the new Command to the History 228 this->history ->add(newCommand);229 if (this->history ->getSize() > this->historyLength)230 { 231 delete[] this->history ->firstElement();232 this->history ->remove(this->history->firstElement());224 this->history.push_back(newCommand); 225 if (this->history.size() > this->historyLength) 226 { 227 delete[] this->history.front(); 228 this->history.pop_front(); 233 229 } 234 230 … … 248 244 char* currentText = new char[strlen(this->inputLine)+1]; 249 245 strcpy(currentText, this->inputLine); 250 this->history ->add(currentText);246 this->history.push_back(currentText); 251 247 this->historyScrolling = true; 252 this->historyIT ->lastElement();253 } 254 255 char* prevElem = this->historyIT->prevStep();248 this->historyIT = this->history.end(); 249 } 250 251 char* prevElem = *(this->historyIT--); 256 252 if (prevElem == NULL) 257 253 return; … … 270 266 if (!this->historyScrolling) 271 267 return; 272 char* nextElem = this->historyIT->nextStep();268 char* nextElem = *(this->historyIT++); 273 269 if (nextElem == NULL) 274 270 return;
Note: See TracChangeset
for help on using the changeset viewer.