aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/terminaldock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui/terminaldock.cpp')
-rw-r--r--qtmips_gui/terminaldock.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/qtmips_gui/terminaldock.cpp b/qtmips_gui/terminaldock.cpp
index 60271f9..8ae419a 100644
--- a/qtmips_gui/terminaldock.cpp
+++ b/qtmips_gui/terminaldock.cpp
@@ -75,10 +75,16 @@ void TerminalDock::setup(machine::SerialPort *ser_port) {
}
void TerminalDock::tx_byte(unsigned int data) {
+ bool at_end = terminal_text->textCursor().atEnd();
if (data == '\n')
append_cursor->insertBlock();
else
append_cursor->insertText(QString(QChar(data)));
+ if (at_end) {
+ QTextCursor cursor = QTextCursor(terminal_text->document());
+ cursor.movePosition(QTextCursor::End);
+ terminal_text->setTextCursor(cursor);
+ }
}
void TerminalDock::tx_byte(int fd, unsigned int data)