Changeset 8858 for code/trunk/src/libraries/core/command/IOConsolePOSIX.cc
- Timestamp:
- Aug 23, 2011, 12:45:53 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 1 build 2 2 codeblocks 3 vs 3 4 dependencies
-
- Property svn:mergeinfo changed
/code/branches/output (added) merged: 8739-8740,8765,8771-8772,8774-8780,8787-8789,8794-8799,8801,8803-8812,8814,8816-8817,8820,8822,8825-8837,8840,8844,8846,8848-8850,8853-8854
- Property svn:ignore
-
code/trunk/src/libraries/core/command/IOConsolePOSIX.cc
r8729 r8858 37 37 #include "util/Clock.h" 38 38 #include "util/Math.h" 39 #include "util/output/ConsoleWriter.h" 39 40 #include "core/Game.h" 40 41 #include "core/input/InputBuffer.h" … … 55 56 56 57 IOConsole::IOConsole() 57 : shell_(new Shell(" IOConsole", false))58 : shell_(new Shell("Console", false)) 58 59 , buffer_(shell_->getInputBuffer()) 59 60 , cout_(std::cout.rdbuf()) … … 74 75 75 76 // Disable standard std::cout logging 76 OutputHandler::getInstance().disableCout();77 ConsoleWriter::getInstance().disable(); 77 78 // Redirect std::cout to an ostringstream 78 79 // (Other part is in the initialiser list) … … 88 89 std::cout.flush(); 89 90 if (!this->origCout_.str().empty()) 90 this->shell_->addOutput(this->origCout_.str(), Shell:: None);91 this->shell_->addOutput(this->origCout_.str(), Shell::Cout); 91 92 // Erase input and status lines 92 93 this->cout_ << "\033[1G\033[J"; … … 102 103 std::cout.rdbuf(this->cout_.rdbuf()); 103 104 // Enable standard std::cout logging again 104 OutputHandler::getInstance().enableCout();105 ConsoleWriter::getInstance().enable(); 105 106 } 106 107 … … 229 230 if (!this->origCout_.str().empty()) 230 231 { 231 this->shell_->addOutput(this->origCout_.str(), Shell:: None);232 this->shell_->addOutput(this->origCout_.str(), Shell::Cout); 232 233 this->origCout_.str(""); 233 234 } … … 239 240 switch (type) 240 241 { 241 case Shell::Error: this->cout_ << "\033[91m"; break; 242 case Shell::Warning: this->cout_ << "\033[93m"; break; 243 case Shell::Info: this->cout_ << "\033[90m"; break; 244 case Shell::Debug: this->cout_ << "\033[90m"; break; 245 case Shell::Verbose: this->cout_ << "\033[90m"; break; 246 case Shell::Ultra: this->cout_ << "\033[90m"; break; 247 case Shell::Command: this->cout_ << "\033[36m"; break; 248 case Shell::Hint: this->cout_ << "\033[33m"; break; 249 case Shell::TDebug: this->cout_ << "\033[95m"; break; 250 default: break; 242 case Shell::Message: 243 case Shell::DebugOutput: this->cout_ << "\033[0m"; break; 244 245 case Shell::UserError: this->cout_ << "\033[91m"; break; 246 case Shell::UserWarning: this->cout_ << "\033[93m"; break; 247 case Shell::UserStatus: this->cout_ << "\033[92m"; break; 248 case Shell::UserInfo: this->cout_ << "\033[96m"; break; 249 250 case Shell::InternalError: this->cout_ << "\033[31m"; break; 251 case Shell::InternalWarning: this->cout_ << "\033[33m"; break; 252 case Shell::InternalStatus: this->cout_ << "\033[32m"; break; 253 case Shell::InternalInfo: this->cout_ << "\033[36m"; break; 254 255 case Shell::Verbose: this->cout_ << "\033[94m"; break; 256 case Shell::VerboseMore: this->cout_ << "\033[34m"; break; 257 case Shell::VerboseUltra: this->cout_ << "\033[34m"; break; 258 259 case Shell::Command: this->cout_ << "\033[95m"; break; 260 case Shell::Hint: this->cout_ << "\033[35m"; break; 261 262 default: this->cout_ << "\033[37m"; break; 251 263 } 252 264 … … 371 383 void IOConsole::executed() 372 384 { 373 this->shell_->addOutput(this->promptString_ + this->shell_->getInput() + '\n', Shell::Command);385 this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::Command); 374 386 } 375 387 … … 378 390 { 379 391 // Exit is not an option, just do nothing (Shell doesn't really exit too) 380 }381 382 //! Called if only the last output-line has changed383 void IOConsole::onlyLastLineChanged()384 {385 // Save cursor position and move it to the beginning of the first output line386 this->cout_ << "\033[s\033[1A\033[1G";387 // Erase the line388 this->cout_ << "\033[K";389 // Reprint the last output line390 this->printOutputLine(this->shell_->getNewestLineIterator()->first, this->shell_->getNewestLineIterator()->second);391 // Restore cursor392 this->cout_ << "\033[u";393 this->cout_.flush();394 392 } 395 393
Note: See TracChangeset
for help on using the changeset viewer.