Index: code/branches/console/src/core/InputBuffer.h
===================================================================
--- code/branches/console/src/core/InputBuffer.h	(revision 1321)
+++ code/branches/console/src/core/InputBuffer.h	(revision 1322)
@@ -62,4 +62,7 @@
             InputBuffer();
             InputBuffer(const std::string allowedChars);
+
+            inline void setKeyboard(OIS::Keyboard* keyboard)
+                { this->keyboard_ = keyboard; }
 
             template <class T>
Index: code/branches/console/src/core/InputHandler.cc
===================================================================
--- code/branches/console/src/core/InputHandler.cc	(revision 1321)
+++ code/branches/console/src/core/InputHandler.cc	(revision 1322)
@@ -39,4 +39,5 @@
 #include "InputEvent.h"
 #include "InputManager.h"
+#include "CommandExecutor.h"
 
 namespace orxonox
@@ -89,4 +90,5 @@
     {
       InputManager::getSingleton().setInputMode(IM_KEYBOARD);
+      CommandExecutor::execute("openConsole");
     }
     else
Index: code/branches/console/src/core/InputManager.cc
===================================================================
--- code/branches/console/src/core/InputManager.cc	(revision 1321)
+++ code/branches/console/src/core/InputManager.cc	(revision 1322)
@@ -105,9 +105,12 @@
         // create a keyboard. If none are available the exception is caught.
         keyboard_ = static_cast<OIS::Keyboard*>(inputSystem_->createInputObject(OIS::OISKeyboard, true));
-        COUT(ORX_DEBUG) << "*** InputManager: Created OIS mouse" << std::endl;
+        COUT(ORX_DEBUG) << "*** InputManager: Created OIS keyboard" << std::endl;
+
+        if (this->handlerBuffer_)
+            this->handlerBuffer_->setKeyboard(this->keyboard_);
 
         // create a mouse. If none are available the exception is caught.
         mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true));
-        COUT(ORX_DEBUG) << "*** InputManager: Created OIS keyboard" << std::endl;
+        COUT(ORX_DEBUG) << "*** InputManager: Created OIS mouse" << std::endl;
 
         // Set mouse region
Index: code/branches/console/src/core/OutputBuffer.cc
===================================================================
--- code/branches/console/src/core/OutputBuffer.cc	(revision 1321)
+++ code/branches/console/src/core/OutputBuffer.cc	(revision 1322)
@@ -49,4 +49,25 @@
     }
 
+    OutputBuffer& OutputBuffer::operator<<(std::ostream& (*manipulator)(std::ostream&))
+    {
+                this->stream_ << manipulator;
+                this->callListeners();
+                return *this;
+    }
+
+    OutputBuffer& OutputBuffer::operator<<(std::ios& (*manipulator)(std::ios&))
+    {
+                this->stream_ << manipulator;
+                this->callListeners();
+                return *this;
+    }
+
+    OutputBuffer& OutputBuffer::operator<<(std::ios_base& (*manipulator)(std::ios_base&))
+    {
+                this->stream_ << manipulator;
+                this->callListeners();
+                return *this;
+    }
+
     bool OutputBuffer::getLine(std::string* output)
     {
@@ -59,7 +80,9 @@
 
         if (eof)
+        {
             this->stream_.flush();
+            this->stream_.clear();
+        }
 
-        // Return true if this was a whole new line, ended by \n
         return (!eof);
     }
Index: code/branches/console/src/core/OutputBuffer.h
===================================================================
--- code/branches/console/src/core/OutputBuffer.h	(revision 1321)
+++ code/branches/console/src/core/OutputBuffer.h	(revision 1322)
@@ -32,4 +32,5 @@
 #include <list>
 #include <sstream>
+#include <iostream>
 
 #include "CorePrereqs.h"
@@ -57,4 +58,8 @@
                 return *this;
             }
+
+            OutputBuffer& operator<<(std::ostream& (*manipulator)(std::ostream&));
+            OutputBuffer& operator<<(std::ios& (*manipulator)(std::ios&));
+            OutputBuffer& operator<<(std::ios_base& (*manipulator)(std::ios_base&));
 
             template <class T>
@@ -88,9 +93,4 @@
             void unregisterListener(OutputBufferListener* listener);
 
-            inline operator std::stringstream&()
-            {
-                return this->stream_;
-            }
-
         private:
             void callListeners();
Index: code/branches/console/src/core/OutputHandler.cc
===================================================================
--- code/branches/console/src/core/OutputHandler.cc	(revision 1321)
+++ code/branches/console/src/core/OutputHandler.cc	(revision 1322)
@@ -124,5 +124,5 @@
 
         if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
-            manipulator(Shell::getInstance().getOutputBuffer());
+            Shell::getInstance().getOutputBuffer() << manipulator;
 
         return *this;
@@ -146,5 +146,5 @@
 
         if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
-            manipulator(Shell::getInstance().getOutputBuffer());
+            Shell::getInstance().getOutputBuffer() << manipulator;
 
         return *this;
@@ -168,5 +168,5 @@
 
         if (OutputHandler::getSoftDebugLevel(OutputHandler::LD_Shell) >= this->outputLevel_)
-            manipulator(Shell::getInstance().getOutputBuffer());
+            Shell::getInstance().getOutputBuffer() << manipulator;
 
         return *this;
Index: code/branches/console/src/core/Shell.cc
===================================================================
--- code/branches/console/src/core/Shell.cc	(revision 1321)
+++ code/branches/console/src/core/Shell.cc	(revision 1322)
@@ -46,7 +46,8 @@
         this->historyPosition_ = 0;
         this->historyOffset_ = 0;
+        this->finishedLastLine_ = true;
 
         this->clearLines();
-/*
+
         this->inputBuffer_.registerListener(this, &Shell::inputChanged, true);
         this->inputBuffer_.registerListener(this, &Shell::execute, '\r', false);
@@ -63,5 +64,7 @@
         this->inputBuffer_.registerListener(this, &Shell::scroll_up, OIS::KC_PGUP);
         this->inputBuffer_.registerListener(this, &Shell::scroll_down, OIS::KC_PGDOWN);
-*/
+
+        this->outputBuffer_.registerListener(this);
+
         this->setConfigValues();
     }
@@ -77,5 +80,7 @@
         SetConfigValue(maxHistoryLength_, 100);
         SetConfigValue(historyOffset_, 0);
-        SetConfigValueVector(commandHistory_, std::vector<std::string>(1, ""));
+        SetConfigValueVector(commandHistory_, std::vector<std::string>());
+
+std::cout << "gaga1: " << this->commandHistory_[this->historyOffset_] << std::endl;
 
         if (this->historyOffset_ >= this->maxHistoryLength_)
@@ -88,4 +93,6 @@
             ModifyConfigValue(commandHistory_, remove, index);
         }
+
+std::cout << "gaga2: " << this->commandHistory_[this->historyOffset_] << std::endl;
     }
 
@@ -120,9 +127,12 @@
     void Shell::addLine(const std::string& line, unsigned int level)
     {
-        if ((*this->lines_.begin()) != "")
-        {
-            orxonox::OutputHandler::getOutStream().setOutputLevel(level) << std::endl;
-        }
-        orxonox::OutputHandler::getOutStream().setOutputLevel(level) << line << std::endl;
+        int original_level = OutputHandler::getOutStream().getOutputLevel();
+        OutputHandler::getOutStream().setOutputLevel(level);
+
+        if (!this->finishedLastLine_)
+            this->outputBuffer_ << std::endl;
+
+        this->outputBuffer_ << line << std::endl;
+        OutputHandler::getOutStream().setOutputLevel(original_level);
     }
 
@@ -130,8 +140,8 @@
     {
         this->lines_.clear();
-        this->lines_.insert(this->lines_.begin(), "");
         this->scrollIterator_ = this->lines_.begin();
 
         this->scrollPosition_ = 0;
+        this->finishedLastLine_ = true;
 
         SHELL_UPDATE_LISTENERS(linesChanged);
@@ -141,14 +151,7 @@
     {
         if (this->scrollPosition_)
-        {
             return this->scrollIterator_;
-        }
         else
-        {
-            if ((*this->lines_.begin()) == "" && this->lines_.size() > 1)
-                return (++this->lines_.begin());
-            else
-                return this->lines_.begin();
-        }
+            return this->lines_.begin();
     }
 
@@ -160,8 +163,12 @@
     void Shell::addToHistory(const std::string& command)
     {
-        this->historyOffset_ = (this->historyOffset_ + 1) % this->maxHistoryLength_;
+std::cout << "command: " << command << std::endl;
+std::cout << "offset: " << this->historyOffset_ << std::endl;
         ModifyConfigValue(commandHistory_, set, this->historyOffset_, command);
-        this->commandHistory_[this->historyOffset_] = command;
+//        this->commandHistory_[this->historyOffset_] = command;
         this->historyPosition_ = 0;
+std::cout << "gaga3: " << this->commandHistory_[this->historyOffset_] << std::endl;
+        ModifyConfigValue(historyOffset_, set, (this->historyOffset_ + 1) % this->maxHistoryLength_);
+std::cout << "offset new: " << this->historyOffset_ << std::endl;
     }
 
@@ -174,29 +181,32 @@
     {
         std::string output;
-        while (this->outputBuffer_.getLine(&output))
-        {
-            bool newline = false;
-            if ((*this->lines_.begin()) == "")
-                newline = true;
-
-            (*this->lines_.begin()) += output;
-
-            SHELL_UPDATE_LISTENERS(onlyLastLineChanged);
-
-            this->lines_.insert(this->lines_.begin(), "");
-
-            if (this->scrollPosition_)
-                this->scrollPosition_++;
-            else
-                this->scrollIterator_ = this->lines_.begin();
-
-            if (newline)
+        bool newline;
+        do
+        {
+            newline = this->outputBuffer_.getLine(&output);
+
+            if (!newline && output == "")
+                break;
+
+            if (this->finishedLastLine_)
             {
+                this->lines_.insert(this->lines_.begin(), output);
+
+                if (this->scrollPosition_)
+                    this->scrollPosition_++;
+                else
+                    this->scrollIterator_ = this->lines_.begin();
+
+                this->finishedLastLine_ = newline;
                 SHELL_UPDATE_LISTENERS(lineAdded);
             }
-        }
-
-        (*this->lines_.begin()) += output;
-        SHELL_UPDATE_LISTENERS(onlyLastLineChanged);
+            else
+            {
+                (*this->lines_.begin()) += output;
+                this->finishedLastLine_ = newline;
+                SHELL_UPDATE_LISTENERS(onlyLastLineChanged);
+            }
+
+        } while (newline);
     }
 
@@ -209,7 +219,8 @@
     void Shell::execute()
     {
-        if (CommandExecutor::execute(this->inputBuffer_.get()))
-            this->addLine(this->inputBuffer_.get(), 0);
-        else
+//        this->addToHistory(this->inputBuffer_.get());
+        this->addLine(this->inputBuffer_.get(), 0);
+
+        if (!CommandExecutor::execute(this->inputBuffer_.get()))
             this->addLine("Error: Can't execute \"" + this->inputBuffer_.get() + "\".", 1);
 
@@ -282,5 +293,5 @@
         if (this->historyPosition_ > 0)
         {
-            this->historyPosition_++;
+            this->historyPosition_--;
             this->inputBuffer_.set(this->getFromHistory());
         }
Index: code/branches/console/src/core/Shell.h
===================================================================
--- code/branches/console/src/core/Shell.h	(revision 1321)
+++ code/branches/console/src/core/Shell.h	(revision 1322)
@@ -118,4 +118,5 @@
             InputBuffer inputBuffer_;
             OutputBuffer outputBuffer_;
+            bool finishedLastLine_;
             std::list<std::string> lines_;
             std::list<std::string>::const_iterator scrollIterator_;
Index: code/branches/console/src/orxonox/console/InGameConsole.cc
===================================================================
--- code/branches/console/src/orxonox/console/InGameConsole.cc	(revision 1321)
+++ code/branches/console/src/orxonox/console/InGameConsole.cc	(revision 1322)
@@ -42,4 +42,5 @@
 #include "core/ConfigValueIncludes.h"
 #include "core/ConsoleCommand.h"
+#include "core/InputManager.h"
 #include "GraphicsEngine.h"
 
@@ -48,9 +49,12 @@
 namespace orxonox
 {
+    ConsoleCommand(InGameConsole, openConsole, AccessLevel::None, true);
+    ConsoleCommand(InGameConsole, closeConsole, AccessLevel::None, true);
+
     using namespace Ogre;
 
     float InGameConsole::REL_WIDTH = 0.8;
     float InGameConsole::REL_HEIGHT = 0.4;
-    float InGameConsole::BLINK = 0.25;
+    float InGameConsole::BLINK = 0.5;
 
     /**
@@ -63,7 +67,10 @@
         this->active_ = false;
         this->cursor_ = 0.0;
+        this->cursorSymbol_ = '|';
 
         this->init();
         this->setConfigValues();
+
+        Shell::getInstance().registerListener(this);
     }
 
@@ -95,5 +102,5 @@
         SetConfigValue(REL_WIDTH, 0.8);
         SetConfigValue(REL_HEIGHT, 0.4);
-        SetConfigValue(BLINK, 0.25);
+        SetConfigValue(BLINK, 0.5);
     }
 
@@ -104,8 +111,15 @@
     {
         std::list<std::string>::const_iterator it = Shell::getInstance().getNewestLineIterator();
-        for (int i = 1; i < LINES && it != Shell::getInstance().getEndIterator(); i++)
-        {
-            this->consoleOverlayTextAreas_[i]->setCaption(*it);
-            ++it;
+        for (int i = 1; i < LINES; i++)
+        {
+            if (it != Shell::getInstance().getEndIterator())
+            {
+                this->print(*it, i);
+                ++it;
+            }
+            else
+            {
+                this->print("", i);
+            }
         }
     }
@@ -117,5 +131,5 @@
     {
         if (LINES > 1)
-            this->consoleOverlayTextAreas_[1]->setCaption(*Shell::getInstance().getNewestLineIterator());
+            this->print(*Shell::getInstance().getNewestLineIterator(), 1);
     }
 
@@ -125,9 +139,5 @@
     void InGameConsole::lineAdded()
     {
-        for (int i = LINES - 1; i > 1; i--)
-            this->consoleOverlayTextAreas_[i]->setCaption(this->consoleOverlayTextAreas_[i - 1]->getCaption());
-
-        if (LINES > 1)
-            this->consoleOverlayTextAreas_[1]->setCaption(*Shell::getInstance().getNewestLineIterator());
+        this->linesChanged();
     }
 
@@ -138,5 +148,5 @@
     {
         if (LINES > 0)
-            this->consoleOverlayTextAreas_[0]->setCaption(Shell::getInstance().getInput());
+            this->print(Shell::getInstance().getInput(), 0);
     }
 
@@ -147,7 +157,7 @@
     {
         std::string input = Shell::getInstance().getInput();
-        input.insert(Shell::getInstance().getCursorPosition(), 1, '|');
+        input.insert(Shell::getInstance().getCursorPosition(), 1, this->cursorSymbol_);
         if (LINES > 0)
-            this->consoleOverlayTextAreas_[0]->setCaption(input);
+            this->print(input, 0);
     }
 
@@ -158,5 +168,5 @@
     {
         this->deactivate();
-        CommandExecutor::execute("set InputMode 2");
+        InputManager::getSingleton().setInputMode(IM_INGAME);
     }
 
@@ -266,5 +276,15 @@
         if (this->cursor_ >= 2 * InGameConsole::BLINK)
             this->cursor_ = 0;
-//        print(convert2UTF(this->ib_->get()));
+
+        if (this->cursor_ >= InGameConsole::BLINK && this->cursorSymbol_ == '|')
+        {
+            this->cursorSymbol_ = ' ';
+            this->cursorChanged();
+        }
+        else if (this->cursor_ < InGameConsole::BLINK && this->cursorSymbol_ == ' ')
+        {
+            this->cursorSymbol_ = '|';
+            this->cursorChanged();
+        }
 
         // this creates a flickering effect
@@ -296,4 +316,6 @@
     void InGameConsole::activate()
     {
+        this->linesChanged();
+
         this->consoleOverlay_->show();
         // just in case window size has changed...
@@ -334,28 +356,8 @@
         @param s String to be printed
     */
-    void InGameConsole::print(Ogre::UTFString s)
-    {
-        if (this->cursor_ > InGameConsole::BLINK)
-            this->consoleOverlayTextAreas_[0]->setCaption(">" + s);
-        else
-            this->consoleOverlayTextAreas_[0]->setCaption(">" + s + "_");
-    }
-
-    /**
-        @brief Shifts all lines up and clears the bottom line.
-    */
-    void InGameConsole::newline()
-    {
-        Ogre::UTFString line;
-        for (int i = LINES - 1; i >= 1; i--)
-        {
-            line = this->consoleOverlayTextAreas_[i - 1]->getCaption();
-            // don't copy the cursor...
-            int l = line.length();
-            if (!line.empty() && line.substr(l-1) == "_")
-                line.erase(l-1);
-            this->consoleOverlayTextAreas_[i]->setCaption(line);
-        }
-        this->consoleOverlayTextAreas_[0]->setCaption(">");
+    void InGameConsole::print(const std::string& text, int index)
+    {
+        if (LINES > index)
+            this->consoleOverlayTextAreas_[index]->setCaption(convert2UTF(text));
     }
 
Index: code/branches/console/src/orxonox/console/InGameConsole.h
===================================================================
--- code/branches/console/src/orxonox/console/InGameConsole.h	(revision 1321)
+++ code/branches/console/src/orxonox/console/InGameConsole.h	(revision 1322)
@@ -71,6 +71,5 @@
             void init();
             void resize();
-            void print(Ogre::UTFString s);
-            void newline();
+            void print(const std::string& text, int index);
             static Ogre::UTFString convert2UTF(std::string s);
 
@@ -84,4 +83,5 @@
             float scrollTimer_;
             float cursor_;
+            char cursorSymbol_;
             bool active_;
             Ogre::OverlayManager* om_;
