- Timestamp:
- Nov 18, 2009, 3:26:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/libraries/core/IOConsole.cc
r6044 r6089 181 181 { 182 182 c = std::cin.get(); 183 if ( std::cin.bad())183 if (!std::cin.good()) 184 184 break; 185 185 … … 278 278 // but that line might very well be the last 279 279 int newLines = std::min((int)this->statusLineWidths_.size(), -heightDiff); 280 this->cout_ << std::string(newLines, '\n'); 281 // Move cursor up again 282 this->cout_ << "\033[" << newLines << 'F'; 280 // Scroll terminal to create new lines 281 this->cout_ << "\033[" << newLines << "S"; 283 282 } 284 283 285 284 if (!this->bStatusPrinted_ && this->willPrintStatusLines()) 286 285 { 287 // Print new lines to make way for status lines 288 this->cout_ << std::string(this->statusLineWidths_.size(), '\n'); 289 // Move cursor up again 290 this->cout_ << "\033[" << this->statusLineWidths_.size() << 'F'; 286 // Scroll console to make way for status lines 287 this->cout_ << "\033[" << this->statusLineWidths_.size() << "S"; 291 288 this->bStatusPrinted_ = true; 292 289 } … … 348 345 this->cout_ << "\033[s"; 349 346 // Move cursor down (don't create a new line here because the buffer might flush then!) 350 this->cout_ << "\033[1 E";347 this->cout_ << "\033[1B\033[1G"; 351 348 this->cout_ << std::fixed << std::setprecision(2) << std::setw(5) << Game::getInstance().getAvgFPS() << " fps, "; 352 349 this->cout_ << std::setprecision(2) << std::setw(5) << Game::getInstance().getAvgTickTime() << " ms tick time"; … … 415 412 { 416 413 // Save cursor position and move it to the beginning of the first output line 417 this->cout_ << "\033[s\033[1 F";414 this->cout_ << "\033[s\033[1A\033[1G"; 418 415 // Erase the line 419 416 this->cout_ << "\033[K"; … … 430 427 // Move cursor to the bottom line 431 428 if (this->bStatusPrinted_) 432 this->cout_ << "\033[" << this->statusLineWidths_.size() << 'E';429 this->cout_ << "\033[" << this->statusLineWidths_.size() << "B\033[1G"; 433 430 // Create new lines on the screen 434 431 int newLines = this->shell_->getNewestLineIterator()->size() / this->terminalWidth_ + 1; 435 432 this->cout_ << std::string(newLines, '\n'); 436 433 // Move cursor to the beginning of the new (last) output line 437 this->cout_ << "\033[" << (newLines + this->statusLineWidths_.size()) << 'F';434 this->cout_ << "\033[" << (newLines + this->statusLineWidths_.size()) << "A\033[1G"; 438 435 // Erase screen from here 439 436 this->cout_ << "\033[J"; … … 442 439 this->printLogText(this->shell_->getNewestLineIterator()->substr(i*this->terminalWidth_, this->terminalWidth_)); 443 440 // Move cursor down 444 this->cout_ << "\033[1 E";441 this->cout_ << "\033[1B\033[1G"; 445 442 // Print status and input lines 446 443 this->printInputLine();
Note: See TracChangeset
for help on using the changeset viewer.