Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6089


Ignore:
Timestamp:
Nov 18, 2009, 3:26:22 PM (14 years ago)
Author:
rgrieder
Message:

Fixed IOConsole on tardis (some ANSI escape sequences were not working)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/libraries/core/IOConsole.cc

    r6044 r6089  
    181181        {
    182182            c = std::cin.get();
    183             if (std::cin.bad())
     183            if (!std::cin.good())
    184184                break;
    185185
     
    278278            // but that line might very well be the last
    279279            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";
    283282        }
    284283
    285284        if (!this->bStatusPrinted_ && this->willPrintStatusLines())
    286285        {
    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";
    291288            this->bStatusPrinted_ = true;
    292289        }
     
    348345            this->cout_ << "\033[s";
    349346            // Move cursor down (don't create a new line here because the buffer might flush then!)
    350             this->cout_ << "\033[1E";
     347            this->cout_ << "\033[1B\033[1G";
    351348            this->cout_ << std::fixed << std::setprecision(2) << std::setw(5) << Game::getInstance().getAvgFPS() << " fps, ";
    352349            this->cout_ <<               std::setprecision(2) << std::setw(5) << Game::getInstance().getAvgTickTime() << " ms tick time";
     
    415412    {
    416413        // Save cursor position and move it to the beginning of the first output line
    417         this->cout_ << "\033[s\033[1F";
     414        this->cout_ << "\033[s\033[1A\033[1G";
    418415        // Erase the line
    419416        this->cout_ << "\033[K";
     
    430427        // Move cursor to the bottom line
    431428        if (this->bStatusPrinted_)
    432             this->cout_ << "\033[" << this->statusLineWidths_.size() << 'E';
     429            this->cout_ << "\033[" << this->statusLineWidths_.size() << "B\033[1G";
    433430        // Create new lines on the screen
    434431        int newLines = this->shell_->getNewestLineIterator()->size() / this->terminalWidth_ + 1;
    435432        this->cout_ << std::string(newLines, '\n');
    436433        // 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";
    438435        // Erase screen from here
    439436        this->cout_ << "\033[J";
     
    442439            this->printLogText(this->shell_->getNewestLineIterator()->substr(i*this->terminalWidth_, this->terminalWidth_));
    443440        // Move cursor down
    444         this->cout_ << "\033[1E";
     441        this->cout_ << "\033[1B\033[1G";
    445442        // Print status and input lines
    446443        this->printInputLine();
Note: See TracChangeset for help on using the changeset viewer.