Changeset 5127 in orxonox.OLD for trunk/src/util
- Timestamp:
- Aug 25, 2005, 3:43:23 AM (19 years ago)
- Location:
- trunk/src/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/util/shell.cc
r5126 r5127 42 42 this->setName("Shell"); 43 43 44 this->shellHeight = 400; 44 this->keepBufferArray[0] = '\0'; 45 this->keepBuffer = false; 46 45 47 this->bActive = false; 46 48 this->buffer = new tList<char>; … … 154 156 } 155 157 158 /** 159 * rebuilds the Text's 160 * 161 * use this function, if you changed the Font/Size or something else. 162 */ 156 163 void Shell::rebuildText() 157 164 { … … 258 265 vsprintf(this->bufferArray, line, arguments); 259 266 260 unsigned int inputLength = strlen(this->bufferArray);261 char* newLineBegin = this->bufferArray;267 char* inputEnd; 268 char* newLineBegin; 262 269 char* newLineEnd; 263 270 264 while (newLineBegin < this->bufferArray + inputLength) 271 // check if we have something left in the buffers 272 if (unlikely(this->keepBuffer)) 273 { 274 strcat(this->keepBufferArray, this->bufferArray); 275 inputEnd = this->keepBufferArray + strlen(this->keepBufferArray); 276 newLineBegin = this->keepBufferArray; 277 this->keepBuffer = false; 278 } 279 else 280 { 281 inputEnd = this->bufferArray + strlen(this->bufferArray); 282 newLineBegin = this->bufferArray; 283 } 284 285 // adding all the new Lines 286 while (newLineBegin < inputEnd) 265 287 { 266 288 newLineEnd = strchr(newLineBegin, '\n'); … … 268 290 *newLineEnd = '\0'; 269 291 else 292 { 293 // newLineEnd = newLineBegin + strlen(newLineBegin); 294 strcpy(this->keepBufferArray, newLineBegin); 295 this->keepBuffer = true; 270 296 break; 297 } 271 298 272 299 char* addLine = new char[strlen(newLineBegin)+1]; -
trunk/src/util/shell.h
r5120 r5127 11 11 12 12 #include <stdarg.h> 13 14 #define SHELL_BUFFER_SIZE 16384 //!< The Size of the input-buffers (should be large enough to carry any kind of input) 13 15 14 16 // FORWARD DECLARATION … … 110 112 bool bActive; //!< if the shell is active; 111 113 112 char bufferArray[10000]; //!< a BUFFER for fast writing 114 char bufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER for fast writing 115 char keepBufferArray[SHELL_BUFFER_SIZE]; //!< a BUFFER to have multi-non-newLine commands be copied into the shell. 116 bool keepBuffer; 113 117 114 118 // completion
Note: See TracChangeset
for help on using the changeset viewer.