Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 31, 2009, 11:13:52 PM (15 years ago)
Author:
rgrieder
Message:

Sorted out some small stuff in the Shell and hopefully fixed IOConsole problems (flickering and too much output).

File:
1 edited

Legend:

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

    r6007 r6010  
    5050{
    5151    IOConsole* IOConsole::singletonPtr_s = NULL;
    52     const std::string promptString_g = "orxonox>";
    5352
    5453#ifdef ORXONOX_PLATFORM_UNIX
     
    6564
    6665    IOConsole::IOConsole()
    67         : shell_(new Shell("IOConsole", false))
     66        : shell_(new Shell("IOConsole", false, true))
    6867        , buffer_(shell_->getInputBuffer())
    6968        , originalTerminalSettings_(new termios())
    7069        , bStatusPrinted_(false)
     70        , promptString_("orxonox> ")
    7171    {
    7272        this->setTerminalMode();
     
    143143                    this->buffer_->buttonPressed(KeyEvent(KeyCode::End,      0, 0));
    144144                else if (escapeSequence == "5~")
    145                     this->buffer_->buttonPressed(KeyEvent(KeyCode::AltPageUp,   0, 0));
     145                    this->buffer_->buttonPressed(KeyEvent(KeyCode::PageUp,   0, 0));
    146146                else if (escapeSequence == "6~")
    147                     this->buffer_->buttonPressed(KeyEvent(KeyCode::AltPageDown, 0, 0));
     147                    this->buffer_->buttonPressed(KeyEvent(KeyCode::PageDown, 0, 0));
    148148                else
    149149                    // Waiting for sequence to complete
     
    192192        this->printStatusLines();
    193193        this->printInputLine();
     194        std::cout.flush();
    194195    }
    195196
     
    227228        // Reset colour to white
    228229//        std::cout << "\033[37m";
    229         std::cout.flush();
    230230    }
    231231
     
    244244        if (this->buffer_->getCursorPosition() > 0)
    245245            std::cout << "\033[" << this->buffer_->getCursorPosition() << "C";
    246         std::cout.flush();
    247246    }
    248247
     
    259258            }
    260259            std::cout << "Status" << std::endl;
    261             std::cout.flush();
    262260            this->bStatusPrinted_ = true;
    263261        }
     
    332330    }
    333331
     332    void IOConsole::printStatusLines()
     333    {
     334    }
     335
    334336#endif /* ORXONOX_PLATFORM_UNIX */
    335337
     
    378380        this->printStatusLines();
    379381        this->printInputLine();
     382        std::cout.flush();
    380383    }
    381384
     
    387390    {
    388391        this->printInputLine();
     392        std::cout.flush();
    389393    }
    390394
     
    396400    {
    397401        this->printInputLine();
     402        std::cout.flush();
    398403    }
    399404
     
    404409    void IOConsole::executed()
    405410    {
    406         // Move cursor the beginning of the line
    407         std::cout << "\033[1G";
    408         // Print command so the user knows what he has typed
    409         std::cout << promptString_g << this->shell_->getInput() << std::endl;
    410         this->printInputLine();
     411        this->shell_->addOutputLine(this->promptString_ + this->shell_->getInput());
    411412    }
    412413
Note: See TracChangeset for help on using the changeset viewer.